6302ENG Image Processing and Machine Vision Assignment

Assignment Help Other Engineering
Reference no: EM132578979

6302ENG Image Processing and Machine Vision - Griffith University

Experiment - Digital Images and Basic Image Processing

Aim

The aim of this experiment is to understand more fully the practicalities of digital images and basic image processing. The students will also be familiar with the Python programming environment and OpenCV library.

Procedure
Follow the instructions in each section below. The report for this experiment is to be submitted by the Friday of the lab week and should explain the processes and results. Include appropriate images along with a full listing of your Python code. You may work in pairs during the experiment, but you must submit your own report. If you worked with somebody else, please state this on your report.

Python and OpenCV Familiarisation (complete before lab)

If you have never used Python before, it is recommended that you run through some basic tutorials before attempting these lab exercises. Python is a simple but powerful language and is very quick to learn. We will be using only the more basic feature of the language, primarily calls to OpenCV functions, so learning what is necessary should be relatively quick.

1. Reading and Writing Images
Using Python and OpenCV, create a script perform the following tasks. You can download any of the images from the Learning@Griffith site or use your own for this, but they should be colour images.
• Read an image from file. Use the imread() function to do this.
• Print out the basic properties of the image - the dimensions, the total number of pixels, and the data type. Use .size, .shape and .dtype for this.
• Display the image to the screen using the imshow() function. Note that you may need to use waitKey() to pause the program and allow the images to be seen. You can destroy the windows by using destroyAllWindows()
• Write the image to another file using imwrite()
• Extract each colour channel from the image using the split() function. Display each channel separately in its own image, and save each of these to files. Note that OpenCV stores images in the BGR format by default, not RGB, so the first layer will be blue.

2. Bit Depth
Bit depth defines the number of bits used to store each pixel. Most images use 8 bits, but more or fewer bits are possible. To simulate different bit depths, you can use only the n most significant bits for each pixel. You can use a bitwise AND operator (&) to mask each pixel value (assuming it is a byte), for example for a depth of 6 bits you would mask each byte with the byte '11111100' or 252. A bit depth of 2 would be masked with '11000000' or 192. More generally, the mask you would use for a bit depth of n is given by (2n-1)*(28-n)
• Write a Python script which prompts the user to enter a bit depth (1-8) then displays an image in that bit depth. Comment on the difference between bit depth of 8 down to 1.

3. Resampling (Resizing)
Images can be resized using various techniques. In OpenCV, the resize() function is used for this. As well as the image to be resized and the new size of the image (in pixels), this function can also use different interpolation functions to determine new pixel values. These range from very simple nearest neighbour interpolation (INTER_NEAREST) to a complicated Lanczos interpolation over an 8x8 neighbourhood (INTER_LANCZOS4).
• Write a Python script which reads an image and then resizes it by both increasing and decreasing the scale.
• Use three different interpolation methods (see OpenCV tutorial for these values) and comment on the resulting images.
• Show examples of cases where the aspect ratio is both maintained and altered.

4. Geometric Transformations
Images can be translated, scaled and rotated in OpenCV using the warpAffine() function. This function takes an image and transformation matrix (2x3) as input, and returns the transformed image. For simple rotations (multiples of 90 degrees) rotate() can also be used. Read the documentation for these functions, then use them to perform the following tasks:
• Read an image from file
• Transform the image by rotating it 90 degrees clockwise, then save the file (to a new filename)
• Transform the original image by asking the user to enter a value in degrees, then rotating the image by this much. Note that you can either calculate the transformation matrix manually or create it with getRotationMatrix2D(). Display these transformed images and save to file.
• Use the same function warpAffine() to translate the image by a constant amount, and display and save this image.
• Some of these operations will cause parts of the image to be lost, as it goes outside the borders. To overcome this you can first 'pad' the image by adding additional pixels to each side. Use the copyMakeBorder() function to do this. Repeat the rotation exercise, but first add a border to the image of an appropriate size to avoid any pixels being lost. Display and save these images.

5. Arithmetic Image Operations

It is possible to perform arithmetic operations on images using either scalar values or other images. Scalar operations can be performed using the normal arithmetic operators (+, -, *, /, etc). In this case the operation is applied independently to every pixel in the image. Any value which overruns the maximum value of the data type (typically 255 for uint8) will be 'reset' to 0 and continue adding (modulo addition). Another way to add images is using the add() function in OpenCV. Unlike numpy addition, this operation saturates at the maximum pixel value, so these pixels will stay white and not reset back to 0 again.

• Try adding a constant value to every pixel in an image, then displaying the result. Note what happens as the value you add gets high.

• Repeat this operation using the OpenCV add() function and comment on the difference.

Images can also be combined using either normal operators (+, -) which will perform modulo operations ('reset' after passing limits), or using the OpenCV add() or addWeighted() functions. addWeighted() has additional arguments that determine how much each image contributes to the final image. This can be used to add a watermark to an image, for example. Note that the images must be of the same size to be added in this way!

• Use addWeighted() to combine two images in various weightings. Save and comment on the results.

Attachment:- Image Processing and Machine Vision.rar

Reference no: EM132578979

Questions Cloud

Why scope and time management is important : Provide a short reflection on why Scope and Time Management is important during project lifecycle.
Summarize the story briefly providing the ethical dilemma : Summarize the story briefly providing the ethical dilemma and parties involved. Discuss three healthcare rules, regulations, or laws relevant to the story.
Describe the four type of macromolecules : Describe the four type of macromolecules (proteins, carbs, lipids, nucleic acids) including an example of each
Hydrolysis and dehydration synthesis : What is the difference between hydrolysis and dehydration synthesis.
6302ENG Image Processing and Machine Vision Assignment : 6302ENG Image Processing and Machine Vision Assignment Help and Solution, Griffith University - Assessment Writing Service
What is the dnp role in the policy needed to enact changes : The Commonwealth Fund provides an international review of health care systems. Read the Commonwealth Fund report, International Profiles of Health Care Systems.
Discussion about the universal health care : Explore a country that provides universal health care. What are its health outcomes? How do these outcomes compare to those in the United States?
Find cost of revenue for the next three years : How do figure a 3 year financial projection for Nordstrom for Revenue if the actual performance for 2018 is $15,860 and 2019 is $15,524.
Explain artistic movement associated with the work of art : Explain the artistic movement associated with the work of art. Describe the style of the artist (How is the artist unique within the movement?)

Reviews

Write a Review

Other Engineering Questions & Answers

  Characterization technology for nanomaterials

Calculate the reciprocal lattice of the body-centred cubic and Show that the reciprocal of the face-centred cubic (fcc) structure is itself a bcc structure.

  Calculate the gasoline savings

How much gasoline do vehicles with the following fuel efficiencies consume in one year? Calculate the gasoline savings, in gallons per year, created by the following two options. Show all your work, and draw boxes around your answers.

  Design and modelling of adsorption chromatography

Design and modelling of adsorption chromatography based on isotherm data

  Application of mechatronics engineering

Write an essay on Application of Mechatronics Engineering

  Growth chracteristics of the organism

To examine the relationship between fermenter design and operating conditions, oxygen transfer capability and microbial growth.

  Block diagram, system performance and responses

Questions based on Block Diagram, System Performance and Responses.

  Explain the difference in a technical performance measure

good understanding of Mil-Std-499 and Mil-Std-499A

  Electrode impedances

How did this procedure affect the signal observed from the electrode and the electrode impedances?

  Write a report on environmental companies

Write a report on environmental companies

  Scanning electron microscopy

Prepare a schematic diagram below of the major parts of the SEM

  Design a pumping and piping system

creating the pumping and piping system to supply cool water to the condenser

  A repulsive potential energy should be a positive one

Using the data provided on the webvista site in the file marked vdw.txt, try to develop a mathematical equation for the vdW potential we discussed in class, U(x), that best fits the data

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd