changing the pixel color in an image

조회 수: 4 (최근 30일)
Busy Bee
Busy Bee 2018년 1월 17일
답변: Image Analyst 2018년 1월 18일
I have a raster image and I have the coordinates of the shown point. I need to change the colour of the area occupied by the image(i.e. the black pixels) in the two perpendiculars drawn from the same point(along x and y-axis). Is there any function that I can use?
  댓글 수: 2
Jan
Jan 2018년 1월 17일
I do not understand the question. What is "the coloured area"? Do you mean the black pixels which are under the green bars? Or inside the rectangle built by the green bars?
Busy Bee
Busy Bee 2018년 1월 17일
편집: Busy Bee 2018년 1월 17일
after changing the colour of the black pixels inside the rectangle to yellow, i needed to know the total number of yellow pixels. But now i get that I can do it directly using the find command.

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

채택된 답변

Image Analyst
Image Analyst 2018년 1월 18일
Convert your calibrated x,y into rows and columns, then make two masks and AND them together and use sum() to count pixels
yellowMask = rectangleMask & ~blackPolygonMask;
numYellowPixels = sum(yellowMask(:))

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by