//to add a range of pixels by using a Widthstep method//Sandy//Time: 2015-10-5#include <cv.h>#includeintMainintargcChar**argv) { //Loading Picturesiplimage*interest_img; Interest_img=cvloadimage ("e:\\picture\\d.jpg",1); //define a rectangle as an area of interestCvrect Rect=cvrect ( -, Max, -, -); //Create Iplimage image header, make image size, depth and number of channelsIplimage *sub_img=Cvcreateimageheader (Cvsize (rect.width,rect.height),//scale of image = Rectangle scaleInterest_img->depth, interest_img-nchannels); Sub_img->origin =interest_img->origin;//define the location of the origin of the image coordinatesSub_img->widthstep =interest_img->Widthstep; //ImageData Pointer to interest sub-areaSub_img->imagedata =interest_img->imagedata +Rect.y*interest_img->widthstep +Rect.x*interest_img->nchannels; //Blue Channel addedCvadds (Sub_img,cvscalar ( -), sub_img);//"Storing a single-channel image in pixels: cvscalar (255)" adds the first SUB_IMG element to the Cvscalar (100) to the second sub_img. //ShowCvnamedwindow ("Roi_add",1); Cvshowimage ("Roi_add", sub_img); //ReleaseCvreleaseimageheader (&sub_img); Cvwaitkey (); return 0;}
Using Widthstep method to increase the pixel----of a range and imageroi contrast