I am using a colour image to create a 3-d plot of pixel intensity. I have to turn it gray for the project to work, but I would like to know how to make the 3-d plot of pixel intensity, on the original without changing its colour.

조회 수: 3 (최근 30일)
close all;clc;clear all;
resize_value = 0.3; % 0From to 1
% TraceImage = imresize(rgb2gray(imread('Trace6.jpg')),resize_value);
TraceImage = imresize(rgb2gray(imread('f1-38-6st.jpg')),resize_value);
original = TraceImage;
bw = im2bw(TraceImage,graythresh(TraceImage)); %
% 3D http://www.mathworks.com/matlabcentral/answers/91442-how-do-i-create-a-3-d-plot-of-the-pixel-intensity-of-an-image-in-matlab
I=TraceImage;
[x,y]=size(I);
X=1:x;
Y=1:y;
[xx,yy]=meshgrid(Y,X);
i=im2double(I);
figure;mesh(xx,yy,i);
colorbar
figure;imshow(i)

채택된 답변

John BG
John BG 2016년 4월 26일
What you call pixel intensity, is the grey scale, or luminance.
The link you have is just a NxM grey scale.
What you seem to want is to go from NxMx3 coloured image to grey scale and back.
Basically, you translate RGB to greyscale with
A1=A(:,:,1);A2=A(:,:,2);A3=A(:,:,3)
Y_CCIR601=.299*A1+.587*A2+.114*A3
If you find this answer of any help solving your question,
please click on the thumbs-up vote link,
thanks in advance
John
  댓글 수: 2
Vladimir Zorin
Vladimir Zorin 2016년 4월 27일
A1=A(:,:,1);A2=A(:,:,2);A3=A(:,:,3) Y_CCIR601=.299*A1+.587*A2+.114*A3
Where should I put this, in which line on the work sheet?
John BG
John BG 2017년 2월 23일
A=imread('flip_this.jpg');
imshow(A)
A1=A(:,:,1);A2=A(:,:,2);A3=A(:,:,3);
surf(Y_CCIR601,'LineStyle','none')
colorbar
.
.
If you find this answer of any help solving your question,
please click on the thumbs-up vote link,
thanks in advance
John

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

추가 답변 (1개)

Image Analyst
Image Analyst 2016년 4월 26일
편집: Image Analyst 2016년 4월 26일

카테고리

Help CenterFile Exchange에서 Image Segmentation and Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by