Write and put notation inside image?

I people, I have two images and i applied the sift flow code, my images represent the blood flow.through the difference between the two images can obtain the direction of blood flow.this difference results in a single image (matrix), I converted all the values in the array into a vector, my idea is to sort an array positions for the non-repeated values, and adding to the sum of the other array positions repeated, for example:
A=[1 1 0 0 0; 0 0 0 1 1; 1 1 1 1 1]
vector=[1 1 0 0 0 0 0 0 1 1 1 1 1 1 1]
non-repeated=[0 1]
sum_positions=[6 9]
I'm trying to do this in order to group the values in an equal position. So when do imshow () values that have between 0 and 50 can write in the image "background". 51 and 100 "background or not" can someone help me

 Accepted Answer

Image Analyst
Image Analyst on 29 Jun 2014
In your example, what variables do you already have and which do you want to obtain? And what does imshow() have to do with anything? None of your variables have values like 51 or 100 . And how did you obtain sum_positions as 6 and 9? What is being summed????

9 Comments

Biza's "Answer" moved here since it's not an answer to the original posted question but actually a reply to me.
Image Analyst, I have one matrix with 25345 values between 0 and 255 values some repeated. I want to create two vectors, one with no repeated values, and another that counts the values that repeat ... for example
clc;
clear all;
close all;
A=imread('imagem60.tif');%load image
A = double(A);
vector=A(:); %conversion image on vector
C=unique(vector') %turn values in one unique vector
dimentionA = length(vector);%count dimension of A
dimentionC = length(C);%count dimension of unique vector of C
count =0; % count initialise in 0
for (i=1:dimentionC) %
for (j=1:dimentionA)
end
end
Now with these two for loops, I want to check on the position c how many values of A are repeated. Like the first position equal to C 0, as many 0 exist in the vector A. He runs A vector and sum all 0. should you not find more moves to the next position in C vector and 2 is now the new value to find. And go to vector A and crosses the whole array and counts how many values there are 2. do this until there are no more values in the vector C.
Before that I command values or order (color) and between intrevalos color values between 0 and 50, I put a note on the image mark the region as "background", the interval between 51 and 100 to 255 other note.
You don't need to call unique(), simple call imhist() and look for bins that have only 1 count:
[pixelCounts, grayLevels] = imhist(A);
uniqueIndexes = pixelCounts == 1;
uniqueGrayLevels = grayLevels(uniqueIndexes);
Every gray level is counted, and this is a lot simpler than what you proposed.
I don't know what "intrevalos color values" are. Please define.
Biza's "Answer" again moved here since it's not an Answer to his original question:
sorry I'am portuguese, intervals values "color between Gray levels"
I don't know what color between gray levels means either, but I trust that my code will help you solve your problem. Let me know if you tried it and it does not do what you want.
I try your code but don't shoe anything, and just convert all value to zero
Biza's "Answer" yet again moved here since it's not an Answer to his original question. Biza, quit posting answers to your questions unless you've solved them. If you reply to someone, post it as a comment.
Image Analyst I checked what I needed for my work, and...
contagem =0;
for i=1:length(C) %
r =bwconncomp(direcao==C(i),4);
contagem = contagem+1;
end
end
Now I just need, grouping pixels of similar values, in short intervals and assign each interval a gray color
What are you doing? Do you just want to assign each connected component a unique color? If so, do this:
labeledImage = bwlabel(binaryImage, 8); % Label each blob so we can make measurements of it
coloredLabels = label2rgb (labeledImage, 'hsv', 'k', 'shuffle'); % pseudo random color labels
imshow(coloredLabels);
my image is in grayscale and I want to group similar pixels and assigning a color to each group. example: between 0 and 25 pixel's color "0" (black)
The code I just showed you does exactly that. Did you try it? It came from my Image Segmentation Tutorial http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862 Run that if you want to see it in action.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!