Ask Your Question

modifying pixel value

asked 2013-04-26 17:08:42 -0500

hayden gravatar image

Hello every body, after loading picture, i would like to modify the pixel values and write it back i.e. the modified image. Could any one give me some hint how can that be done. Thanks.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-04-26 22:04:57 -0500

wuling gravatar image

updated 2013-04-27 01:47:15 -0500

Hi,I use Mat format. If you have a gray picture & change a pixel. like:<uchar>(i,j)=valve// where i is image row & j is image cols & 0<=value<=255

if you want to change all picture value:

for(int y = 0; y < image.row; y++)
    for(int x = 0 < image.col; x++)
         //where operator is image processing algorithm

& please ref Mat::isContinuous and other Mat operator :

If you want lower cost time. I think you should ref opencv code:SSE & AVX or CUDA

edit flag offensive delete link more


how can i modify pixel value from 0 to 0.01 ?

Deepak Kumar gravatar imageDeepak Kumar ( 2014-11-14 05:48:03 -0500 )edit

Question Tools


Asked: 2013-04-26 17:08:42 -0500

Seen: 11,550 times

Last updated: Apr 27 '13