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
    4 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
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 comentarios
  Walter Roberson
      
      
 el 1 de Abr. de 2024
				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.
Respuestas (0)
Ver también
Categorías
				Más información sobre Matrix Indexing en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



