how to get the pixel value and the location in an image

조회 수: 1 (최근 30일)
Karbala'a Unvi. Science
Karbala'a Unvi. Science 2020년 6월 18일
댓글: Ameer Hamza 2020년 6월 20일
Hi to evryone,
I am looking for a code, that find and write the location and the value (attomatically)of each pixel in an image ..
I know that there is a lot of work need to do insted of asking, but I am welling to collacet any help to do that code
Welling to have an answer from my fellow freinds here in this community..
Best of all wishes

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 6월 19일
See ginput(). For example, run this
img = imread('pears.png');
imshow(img)
[x, y] = ginput(1);
pixel_values = img(floor(x), floor(y), :);
disp(pixel_values)
  댓글 수: 2
Karbala'a Unvi. Science
Karbala'a Unvi. Science 2020년 6월 19일
Dear Sir,
I tried this code you sent, but it still giving the error below
Error in Untitled (line 5)
pixel_values = img(floor(x), floor(y), :);
of course ,thank you , but what i need is a code that aottomaticaly gives (value and location) of all the pixeles of an image
thank you very much in advance
yours
Z
Ameer Hamza
Ameer Hamza 2020년 6월 20일
What is the complete error message? Can you explain in which format do you want all the pixel values? All the pixel values are already stored in the array 'img'.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Computer Vision with Simulink에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by