Binary Mask and gray scale image

조회 수: 8 (최근 30일)
abrassart stephan
abrassart stephan 2020년 7월 15일
편집: Walter Roberson 2020년 7월 16일
I have a binary mask and i want to extract the value of a grayscale image in a other variable. How can i do this ?
(if the pixel (159,300) in the mask = 1, and the pixel(159,300)in the grayscale image = 67, return 67 in the variable).
Thanks for your help.
Stéphan

답변 (1개)

Sugar Daddy
Sugar Daddy 2020년 7월 15일
I = imread('circle.jpg');
I = rgb2gray(I);
M = I<125;
figure,subplot(121),imshow(I)
subplot(122),imshow(M)
To access Image index where mask value is 1, simply apply Logical Indexing
L = I(M);
figure,plot(L)
  댓글 수: 1
abrassart stephan
abrassart stephan 2020년 7월 15일
편집: Walter Roberson 2020년 7월 16일
En utilisant la variable seg comme masque, extraire les éléments intensite_region de l’image imgf qui appartiennent à la région segmentée dans seg (c.-à-d. les éléments qui sont à 1 dans seg).
imgf(510,628)
seg(510,628)
intensite_region = imgf where pixel of seg=1
intensite_region must be (510,628)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Author Block Masks에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by