필터 지우기
필터 지우기

I created a matlab gui to determine the length and width of a foot, the area of an existing foot, and use it to determine the size of the foot as well. here is the code I used

조회 수: 1 (최근 30일)
I created a matlab gui to determine the length and width of a foot, the area of an existing foot, and use it to determine the size of the foot as well. here is the code I used. but why do the results tend to be invalid, is there a solution?
a=getappdata(0,'a');
a_gray=rgb2gray(a);
axes(handles.axes2);
imshow(a_gray);
% Menetapkan ambang batas (contoh: ambang batas = 150, sesuaikan sesuai kebutuhan)
threshold = 115;
% Membuat mask untuk piksel cerah
brightPixelsMask = a_gray > threshold;
% Menampilkan gambar grayscale yang hanya menyoroti piksel cerah di axes 2
imshow(brightPixelsMask, 'Parent', handles.axes2);
% Menghitung panjang dan lebar dari area cerah
stats = regionprops(brightPixelsMask, 'MajorAxisLength', 'MinorAxisLength');
if ~isempty(stats)
majorAxisLength = stats.MajorAxisLength;
minorAxisLength = stats.MinorAxisLength;
% Menampilkan hasil di static text
resultString = sprintf('Panjang: %.2f pixel, Lebar: %.2f pixel', majorAxisLength, minorAxisLength);
set(handles.text3, 'String', resultString);
% Meminta pengguna untuk memasukkan nilai resolusi
prompt = 'Masukkan nilai resolusi (PPI):';
dlgTitle = 'Input Resolusi';
numLines = 1;
defaultResolusi = '300'; % Nilai default
answer = inputdlg(prompt, dlgTitle, numLines, {defaultResolusi});
if ~isempty(answer)
% Mengambil nilai resolusi dari masukan pengguna
resolusiScanner = str2double(answer{1});
% Menghitung panjang dan lebar dalam milimeter
panjang_mm = (majorAxisLength / resolusiScanner) * 2540 * 10;
lebar_mm = (minorAxisLength / resolusiScanner) * 2540 * 10;
% Menampilkan hasil akhir di static text
resultStringFinal = sprintf('Panjang: %.2f mm, Lebar: %.2f mm', panjang_mm, lebar_mm);
set(handles.text3, 'String', resultStringFinal);
else
% Jika pengguna membatalkan pemilihan resolusi
set(handles.text3, 'String', 'Pemilihan resolusi dibatalkan.');
end
else
% Jika tidak ada area cerah, tampilkan pesan kosong
set(handles.text3, 'String', 'Tidak ada area cerah.');
end
  댓글 수: 5
rizqi basith
rizqi basith 2024년 4월 1일
@DGM because I did the foot scan, I really have the full specifications of the image, sorry i can not understand for for the questions about "how i trying to present it" what it mean?
Walter Roberson
Walter Roberson 2024년 4월 1일
No, the results of the foot scan in jpeg format cannot simultaneously store heat and pressure. JPEG can store only one value per location, so you would need two jpeg to store both heat and pressure.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by