current position:Home>matlab . Image pixel processing

matlab . Image pixel processing

2022-02-02 23:20:43 CSDN Q & A

Read an image and place the image in odd positions (13579…) The pixel value of each point increases 50 Image even position (2468….) The pixel value of each point decreases 50 The original image and the processed image are displayed in the same drawing window




Refer to the answer 1:
clear, close allim1 = imread('cameraman.tif');figuresubplot(1,2,1), imshow(im1), title(' Original picture ')im2 = im1;im2(1:2:end,1:2:end) = im1(1:2:end,1:2:end) + 50; % Odd row odd sequence +50im2(2:2:end,2:2:end) = im1(2:2:end,2:2:end) - 50; % Even rows and even columns -50subplot(1,2,2), imshow(im2), title(' After processing ')

img


Because you didn't say exactly what the odd position is , My default odd position is odd row and odd sequence , Even positions are even rows and even columns .
Again , Because you didn't make it clear whether the image is RGB, I use single channel gray image by default




Refer to the answer 2:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202022320410609.html

Random recommended