c++ - Image Processing How to Apply gradient [-1 | 0 | 1 ] to RGB image -



c++ - Image Processing How to Apply gradient [-1 | 0 | 1 ] to RGB image -

i need apply gradient operator rgb bitmap image. works 8 bit image having difficulty in implementing same 24 bit image. here code. can see how right zorizontal gradient operation rgb image.

if (ibitperpixel == 24) ////rgb 24 bits image { for(int i=0; i<iheight; i++) for(int j=1; j<iwidth-4; j++) { //pimg_gradient[i*wp+j] = pimg[i*wp+j+1] - pimg[i*wp+j-1] ; int level = pimg[i*wp+j*3+1] - pimg[i*wp+j*3-1] ; pimg_gradient[i*wp+j*3] = level; // pimg_gradient[i*wp+j*3] = level; // pimg_gradient[i*wp+j*3+1] = level; // pimg_gradient[i*wp+j*3+2]= level; } for(int i=0; i<iheight; i++) for(int j=0; j<iwidth; j++) { // re-create convetred values original image. pimg[i*wp+j] = (byte) pimg_gradient[i*wp+j]; } //delete pimg_gradient; }

unfortunately, not clear how define gradient of rgb image. best way go transform image color space separates intensity color, such hsv, , compute gradient of intensity component. alternatively, can compute gradient of each color channel separately, , combine results in way, such taking average.

also see edge detectors rgb images?

c++ image-processing bitmap gradient

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -