Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How to verify each position equality?

조회 수: 1 (최근 30일)
Biza Ferreira
Biza Ferreira 2014년 6월 20일
마감: MATLAB Answer Bot 2021년 8월 20일
if true
% code
clc;
clear all;
close all;
A=imread('imagem60.tif');%carrega a imagem
vector=A(:); %converte a matriz em um vector
C=unique(vector')%torna os valores da matriz unicos , sem repticao
dimentionA = length(vector)%contagem da dimencao do vector de todos os valores da matriz
dimentionC = length(C);%contagem dos valores da matriz que sao distintos
count =0; % contagem iniciada em zero
for (i=1:dimentionC) %matriz de dimensao de valores nao repetidos
for (j=1:dimentionA)%matriz de dimensaos de todos os valores
end
end
%code
end
I have write this code, i have one image and i convert the image matrix in one vector(C), and create a new vector(C) with non repeated values, now I want cont in the original matrix how many times the same value, of the value position in the new vector(V) repeat and index him by the position who was read in the new vector(C)

답변 (1개)

Image Analyst
Image Analyst 2014년 6월 20일
Just call imhist().
[pixelCounts, grayLevels] = imhist(grayImage);
If you really need (row, column) location for a particular gray level then you can do
[rows, columns] = find(grayImage == theGrayLevelYouWant);

태그

Community Treasure Hunt

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

Start Hunting!

Translated by