I have a RGB Color image of a flame zone inside a rotary klin(Cement Industry) captured using a CCD Sensor. I have segmented the region of interest (flame zone) and color mapped it. How to apply region growing and find out the temprature?
1 次查看(过去 30 天)
显示 更早的评论
From the captured digital frames, Individual pixels can be separated using region growing technique. Pixel location and its Red (R), Green (G) and Blue (B) colour properties will be obtained for individual pixel. A colour histogram can be used to represent the color compositions of an image. The temperature and its distribution in a frame can be calculated from the ratio between the grey-levels of corresponding pixels within two images captured at selected wavelengths λ1 and λ2. How can we do it in MATLAB? I am stuck with this.. Here is the matlab code i have used for the research purpose.
A=imread('C:\Users\anand\Pictures\indexx.jpg');
figure,imshow(A); title('Original Image');
B=rgb2gray(A);
C=double(A);
for i=1:size(C,1)-2
for j=1:size(C,2)-2
%Sobel mask for x-direction:
Gx=((2*C(i+2,j+1)+C(i+2,j)+C(i+2,j+2))-(2*C(i,j+1)+C(i,j)+C(i,j+2)));
%Sobel mask for y-direction:
Gy=((2*C(i+1,j+2)+C(i,j+2)+C(i+2,j+2))-(2*C(i+1,j)+C(i,j)+C(i+2,j)));
%The gradient of the image
%B(i,j)=abs(Gx)+abs(Gy);
B(i,j)=sqrt(Gx.^2+Gy.^2);
end
end
%B= uint8(B);
figure,imshow(B); title('Sobel gradient');
Thresh=75;
B=max(B,Thresh);
B(B==round(Thresh))=0;
%B= uint8(B);
%D = gray2rgb(B);
figure,imshow(~B);title('Edge detected Image');
hFH = imfreehand();
% Create a binary image ("mask") from the ROI object.
binaryImage = hFH.createMask();
xy = hFH.getPosition;
% Now make it smaller so we can show more images.
%subplot(2, 2, 1);
%imshow(grayImage, []);
%axis on;
%drawnow;
figure,imshow(binaryImage); title('ROI');
% Convert the grayscale image to RGB using the jet colormap.
rgbImage = ind2rgb(B, jet(256));
% Scale and convert from double (in the 0-1 range) to uint8.
rgbImage = uint8(255*rgbImage);
% Display the RGB image.
%subplot(2, 2, 3);
%imshow(rgbImage);
%axis on;
figure,imshow(rgbImage); title('RGB Image from Jet Colormap', 'FontSize', fontSize);
% Extract the red, green, and blue channels from the color image.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
%%Create a new color channel images for the output.
outputImageR = B;
outputImageG = B;
outputImageB = B;
% Transfer the colored parts.
outputImageR(binaryImage) = redChannel(binaryImage);
outputImageG(binaryImage) = greenChannel(binaryImage);
outputImageB(binaryImage) = blueChannel(binaryImage);
% Convert into an RGB image
outputRGBImage = cat(3, outputImageR, outputImageG, outputImageB);
% Display the output RGB image.
%subplot(2, 2, 4);
%imshow(outputRGBImage);
%axis on;
thresholdValue = outputRGBImage(:, :, 1);
temprature = outputRGBImage(100,100,1);
figure,imshow(outputRGBImage); title('RGB IMage', 'FontSize', fontSize);
caption = sprintf('Pixels above Threshold of %.2f', temprature);
figure,imshow(thresholdValue); title(caption, 'FontSize', fontSize);
%M = imfreehand();
% 0 = background pixels (do not change).
% 1 = foreground pixels (change these colors).
%maskImg = M.createMask;
% View the black and white mask.
%figure; imagesc(maskImg); colormap gray; axis image;
% Now let's color the mask green to make it more interesting.
% To do this, we have to make three matrices, one for each color channel.
% Increase the color by half the max value so we can see some transparancy
% in the original image.
%amountIncrease = 255/2;
%alphaImg(:,:,1) = zeros(size(maskImg)); % All zeros.
%alphaImg(:,:,2) = zeros(size(maskImg)); % Round since we're dealing with integers.
%alphaImg(:,:,3) = zeros(size(maskImg)); % All zeros.
% Convert alphaImg to have the same range of values (0-255) as the origImg.
%alphaImg = uint8(alphaImg);
% View alphaImg.
%figure; imagesc(alphaImg); axis image;
% Combine the original images and the alpha values to highlight the select
% pixels.
%blendImg = D + alphaImg;
% Show the blended images.
%figure; imagesc(blendImg); axis image;
0 个评论
回答(1 个)
yingying zhou
2016-3-21
Did you slove this problem?I need to analysis flame, smoke and temperature,flame is easy to solve , smoke and temperature has been no progress, can you give me some help, now I have no progress on the temperature, whether can be extracted from color images and won't stop because of the pedestrian clothes color or color of the building , .Please give some advice or information.Thank you.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Modify Image Colors 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!