⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lhidbshowparts.m

📁 This code can parse any image in matlab. Very elaborate code
💻 M
字号:
function LHIdbshowparts(database, HOMEIMAGES, showsubid, subimages)
%
% Shows part thumbnails (subgraphs) for all the images in the database.
% This function can be used in combination with LHIquery in order to show
% object crops of a single class. 
%
% LHIdbshowobjects(database, HOMEIMAGES, showid, subimages)
%
% showsubid = 0 or 1 (whether show keypoint ids when display subgraph

if nargin < 3
    disp('Too few input parameter');
    return;
end
Nimages = length(database);

if nargin == 4
    Nx = subimages(2);
    Ny = subimages(1);
else
    Nx = 10; Ny = 8; % will show 10x8 images per figure
end
Dx = 1/Nx; Dy = 1/Ny; 

handle=figure; maximize(handle);
x = 0; y = 0;
for i = 1:Nimages
    if isfield(database(i).annotation, 'object')
        Nobjects = length(database(i).annotation.object); n=0;
        try
            img = LHIimread(database, i, HOMEIMAGES); % Load image
            for j = 1:Nobjects
                n = n+1;
                Nparts = length(database(i).annotation.object(n).parts);
                for k = 1:Nparts
                    [crop,imgCrop] = getObjectCrop(database(i).annotation.object(n).parts(k),img);
                    [nrow,ncol,c]=size(imgCrop);
                    imgWhite = uint8(ones(nrow,ncol)*255);
                    h = axes('position', [x*Dx (Ny-y-1)*Dy Dx Dy]); % create axis
                    h=image(imgCrop); axis('off'); axis('equal'); hold on
                    LHIplotobject(database(i).annotation.object(n).parts(k),crop,'r');
                    Nsubgraph = length(database(i).annotation.object(n).parts(k).subgraphs);
                    if (Nsubgraph > 0)
                        x = x+1;
                        if x>Nx-1 & i<Nimages
                            x = 0; y = y+1;
                            if y>Ny-1
                                y = 0;
                                handle=figure;maximize(handle);
                            end
                        end
                        h = axes('position', [x*Dx (Ny-y-1)*Dy Dx Dy]); % create axis
                        h=imshow(imgWhite,[]); axis('off'); axis('equal'); hold on
                        LHIplotobjectsubgraph(database(i).annotation.object(n).parts(k),crop,'r',showsubid);
                        axis('off'); axis('equal');
                    end
                    % hold on
                    drawnow
                    x = x+1;
                    if x>Nx-1 & i<Nimages
                        x = 0; y = y+1;
                        if y>Ny-1
                            y = 0;
                            handle=figure;maximize(handle);
                        end
                    end
                end
            end
        catch
            disp(sprintf('warning: some problem with image %s/%s',database(i).annotation.folder,database(i).annotation.filename))
        end
    end
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -