Prev: how to make some private or protected object's field public?
Next: Data Fusion with Kalman Filter
From: cabrego on 26 Feb 2010 11:15 I have a gray scale image that has been generated through a series of manipualation and mathematical operations and I would like to highlight particular pixel values For example, one thing I would like to highlight (RED) pixel values in the image that are =>1, or maybe even in a particular range, 1>x>1.9. How can I do this simple task...
From: ImageAnalyst on 26 Feb 2010 12:49 % Demo to threshold an image and display the thresholded pixels as red. % Change the current folder to the folder of this m-file. % (The line of code below is from Brett Shoelson of The Mathworks.) if(~isdeployed) cd(fileparts(which(mfilename))); end clc; clear all; close all; workspace; % Read in standard MATLAB demo image. grayImage = imread('cameraman.tif'); subplot(1, 2, 1); imshow(grayImage, []); title('Original Grayscale Image', 'FontSize', 20); set(gcf, 'Position', get(0,'Screensize')); % Maximize figure. % Threshold image thresholdedImage = grayImage < 79; % Get three monochrome images that will end up being the color planes. redPlane = grayImage; greenPlane = grayImage; bluePlane = grayImage; % Assign red to the thresholded part. redPlane(thresholdedImage) = 255; greenPlane(thresholdedImage) = 0; bluePlane(thresholdedImage) = 0; % Make a color version of the image rgbImage = cat(3, redPlane, greenPlane, bluePlane); subplot(1, 2, 2); imshow(rgbImage, []); title('Thresholded Image, Red = < 79 Gray Levels', 'FontSize', 20);
From: cabrego on 3 Mar 2010 15:59 Thanks for the reply works perfect.
From: cabrego on 3 Mar 2010 16:24 I do have a question about what Matlab is doing here. I noticed while the pixels have been colored via RGB planes-there are quite a bit of additional that are black in the image and correspond to RGB 0 0 0. How is matlab determining the color of non red pixels?
From: ImageAnalyst on 3 Mar 2010 21:00 I don't know what you're talking about. Are you referring to my demo code, or your code? In my code, the image is grayscale, so, other than the pixels I colored red, every other pixel is just plain gray. It could be anywhere from (0,0,0) to (255,255,255) but they're all gray, just different intensities. What do you mean by "MATLAB determining the color"? In my example, there's no "determining" - the color is what it is, and that is gray. If it's your code and your image, then you'd have to post both of those so we can take a look.
|
Next
|
Last
Pages: 1 2 Prev: how to make some private or protected object's field public? Next: Data Fusion with Kalman Filter |