extraction of part of image

3 visualizaciones (últimos 30 días)
Smruti Khobragade
Smruti Khobragade el 28 de En. de 2020
Respondida: Subhadeep Koley el 1 de Feb. de 2020
hello,
i want to extract some part of original image bsed of pixel values. for example i want to extract part which have pixel values greater than 200 and other part to be blackened .i dont wanna use im crop bcoz the part i want to extract should depend on pixel values.

Respuesta aceptada

Subhadeep Koley
Subhadeep Koley el 1 de Feb. de 2020
Hi Smruti, the below code might help as you want "to extract the part of original image based on pixel values the output will be same image with threshold 200 and other blacken".
Also you might want to use the Color Thresholder App.
img = imread('peppers.png');
[r, c, b] = size(img);
th_img = uint8(zeros(r,c,b));
th = 100; % Put your threshold here
for i = 1:r
for j = 1:c
if img(i, j, :) > th
th_img(i, j, :) = img(i, j, :);
end
end
end
figure, imshowpair(img, th_img, 'montage');
untitled.png

Más respuestas (1)

Bhaskar R
Bhaskar R el 28 de En. de 2020
im = imread('peppers.png'); % read image
res_image = uint8(im>200).*im; % apply your condition
figure, imashow(res_image);
  7 comentarios
Smruti Khobragade
Smruti Khobragade el 28 de En. de 2020
i want to extract some part of original image bsed of pixel values. for example i want to extract part which have pixel values greater than 200 same as the original image not just same color
i mean to say to extract the part of original image based on pixel values the output will be same image with threshold 200 and other blacken.

Iniciar sesión para comentar.

Categorías

Más información sobre Deep Learning Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by