DSIP Exp 6

of 4
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
  Subject: DSIP   Class:   BE COMPS A.Y. 2019-20EXPERIMENT 6Problem Statement: To implement Image negative, contrast stretching and thresholding. Theory: POINT OPERATIONS: Point operations translate gray scale values on a pixel-by-pixel basis from one image to another. Thegoal of histogram equalization is to find and apply a point operation such that the histogram of themodified image approximates a uniform distribution. Histogram is a discrete distribution &homogeneous point operations can only shift & merge(but never split) histogram entries, we onlyobtain approximate solution in general.Zero memory operations where a given gray level u [0, L] is mapped into a gray level v [0, L] according to ∈ ∈  a transformation  v = f(u)  Input and output gray levels are distributed between [0, L].Typically, L = 255 Image Negative: The negative of an image with grey levels in the range [0, L-1] is obtained by the negativetransformation shown in figure above, which is given by the expression as  s = L – 1 – r  . Thisexpression results in reversing of the gray level intensities of the image thereby producing a negativelike image. In negative transformation, each value of the input image is subtracted from the L-1 andmapped onto the output image. This is particularly useful for enhancing white or gray detailsembedded in dark regions of an image. Contrast Stretching: Often called as Normalisation   is a simple image enhancement technique thatattempts to improve the contrast  in an image by ` stretching ' the range of intensity values it containsto span a desired range of values, e.g. the the full range of pixel values that the image type concernedallows Thresholding: Thresholding is the special case of clipping where output becomes binary.Image Procesing (BE COMPS)  Code: Image Procesing (BE COMPS)  PROGRAM : (CONTRAST STRETCHING) #include <iostream>#include <opencv2/core/core.hpp>#include<opencv2/highgui/highgui.hpp>using namespace cv;using namespace std;int computeOutput(int , int , int , int ,int);int main(){Mat image = imread( image.jpeg );Mat new_image = image.clone();int r1,s1,r2,s2;cout<< Enter r1 : <<endl;cin>>r1;cout<< Enter s1 : <<endl;cin>>s1;cout<< Enter r2 : <<endl;cin>>r2;cout<< Enter s2 : <<endl;cin>>s2;for(int y=0;y<image.rows;y++){for(int x=0;x<image.cols;x++){for(int c=0;c<3;c++){int output = computeOutput(imageat<Vec3b>(y,x)[c],r1,s1.r2,s2);<Vec3b>(y,c)[c] = saturate_ucast<uchar>(output);}}}namedWindow( Original Image ,1);imshow( Original Image ,image);namedWindow( Modified Image ,1);imshow( Modified Image ,new_image);waitKey();return 0;}int computeOutput(int x, int r1 , int s1 , int r2 ,int s2){float result;if(0<=x&& x<=r1){result = s1/r1*x;}elseif(r1<x & x<=r2){result=((s2-s1)/(r2-r1)*(x-r1)+s1;}elseif(r2<x && x<=255){result = ((255-s2)/(255-r2))*x-r2+s2;}return (int)result;Image Procesing (BE COMPS)  } Note: Write your own code Digital Negative and Contrast StretchingConclusion: Single-point processing is a simple method of image enhancement. This techniquedetermines a pixel value in the enhanced image dependent only on the value of the correspondingpixel in the input image. Image Procesing (BE COMPS)

Arif anggara.pdf

Sep 22, 2019


Sep 22, 2019
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks

We need your sign to support Project to invent "SMART AND CONTROLLABLE REFLECTIVE BALLOONS" to cover the Sun and Save Our Earth.

More details...

Sign Now!

We are very appreciated for your Prompt Action!