Consider an image (img
) as
What is the best way to convert all the pixel values to say, 0.8
?
Edit 1 Let me explain my objective. Firstly, I partition the image into 4 parts.
{width, height} = ImageDimensions[img];
Flatten@ImagePartition[img, {225/2, 225/2}];
Now I want to change the pixel values of the first image part to be 0.8
and then merge all the parts together. One thing to be noted here is that I don't have the information about the pixel values in the parts and all the pixels may not have the same value.
One issue in changing the pixel value in the part image is that it may create artifacts in the boundary while merging them together after changing pixel value. Therefore, I need a way such that there be a mapping between the first part and the corresponding portion in the original image so that I can make the changes directly on the image instead on the part.
Edit 2 I have applied image partitioning to treat individual parts as blocks so that I can compare the blocks with its neighbor to set the condition for changing the pixel value in a block.
img = Image[ConstantArray[0.8, ImageDimensions[img][[{-1, 1}]]]]
$\endgroup$