亚洲av无码精品色午夜果冻不卡-亚洲av无码专区在线观看成人-国产在线观看香蕉视频-国产乱对白刺激视频-亚洲国产精品久久艾草

您好,歡迎訪問深圳市深恒安科技有限公司官網!
VOC檢測儀-甲醛檢測儀-氣體報警器-氣體檢測儀廠家-深恒安科技有限公司
聯系我們
VOC檢測儀-甲醛檢測儀-氣體報警器-氣體檢測儀廠家-深恒安科技有限公司
郵箱:Gaspanda@163.com
電話:18028784534
地址:深圳市寶安區新安街道文雅社區寶民一路203號
當前位置: 主頁 > 檢測儀知識百科

檢測儀知識百科

水果檢測儀 【水果識別】基于matlab GUI蘋果質量檢測及分級系統【含Matlab源碼
發布時間:2021-05-26 16:01瀏覽次數:

一、簡介

現在商業行為中,在水果出廠前都需要進行質量檢測,需要將不同等級的水果進行分級包裝,以保證商業利益最大化。可是傳統方法都是依靠人工進行檢測,效率低下,主觀成分大,并不能很好客觀地評價出貨質量,導致工廠損失利益水果檢測儀水果檢測儀,增加客戶投訴,從而造成品牌效率損失乙炔檢測儀,造成隱形的損失。

該課題為基于MATLAB的水果分級系統。適用圓形水果,如蘋果酒精檢測儀,橘子水果檢測儀,柚子,柿子等,統計水果圖片的面積,圓形度和色澤等多參數進行評價。該設計帶一個GUI界面,通過設置直徑和色澤,測試水果的這些參數,從而得出該水果所屬等級。

二、源代碼

function varargout = appletest(varargin)
% APPLETEST MATLAB code for appletest.fig
%      APPLETEST, by itself, creates a new APPLETEST or raises the existing
%      singleton*.
%
%      H = APPLETEST returns the handle to a new APPLETEST or the handle to
%      the existing singleton*.
%
%      APPLETEST('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in APPLETEST.M with the given input arguments.
%
%      APPLETEST('Property','Value',...) creates a new APPLETEST or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before appletest_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to appletest_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help appletest
% Last Modified by GUIDE v2.5 19-Oct-2019 20:28:04
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
    'gui_Singleton',  gui_Singleton, ...
    'gui_OpeningFcn', @appletest_OpeningFcn, ...
    'gui_OutputFcn',  @appletest_OutputFcn, ...
    'gui_LayoutFcn',  [] , ...
    'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before appletest is made visible.
function appletest_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to appletest (see VARARGIN)
% Choose default command line output for appletest
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes appletest wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = appletest_OutputFcn(hObject, eventdata, handles)
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[filename,pathname]=uigetfile({'*.*';'*.bmp';'*.jpg';'*.tif';'*.jpg'},'選擇圖像');
image=[pathname,filename];%合成路徑+文件名
im=imread(image);%讀取圖像
im=im2double(im);
axes(handles.axes1);
imshow(im);%在坐標axes1顯示原圖像
title('原始圖像');
handles.X1=im;
guidata(hObject,handles);
% --- Executes on selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu1
Val=get(hObject,'Value')
strl=get(hObject,'string')
switch strl{Val};
    
    case '   面積'
        
        
        x1=handles.X1;
        
        w=rgb2gray(x1);
        
        L=medfilt2(w);
        
        level=graythresh(L);
        
        bw=im2bw(L,level);
        
        bw=imfill(~bw,'holes');
        
        axes(handles.axes2);
        
        imshow(bw);
        
        title('面積圖像');
        
        strNC=[num2str(bwarea(bw))];
        
        set(handles.text9,'string',strNC);
        strNC1=('一級果');
        strNC2=('二級果');
        strNC3=('三級果');
        if bwarea(bw)>30000
            set(handles.text14,'string',strNC1);
        else if bwarea(bw)>1000&&bwarea(bw)<30000
                set(handles.text14,'string',strNC2);
            else
                set(handles.text14 ,'string',strNC3);
            end
        end
        
        %     strNC1=('無');
        
        %     set(handles.text14,'string',strNC1);
    case'   顏色'
        
        
        x1=handles.X1;
        
        hv=rgb2hsv(x1);
        
        H=hv(:,:,1);
        
        S=hv(:,:,2);
        
        V=hv(:,:,3);
        
        axes(handles.axes3);
        
        imshow(H)
        
        title('H分量圖像');
        
        level=graythresh(x1);
        
        apple=im2bw(x1,level);
        
        count=length(x1);
        
        for i=1:count
            
            red_ratio=length(find((H>0 & H<1/12) | H>11/12))/length(find(apple==1));
            
        end
        r=red_ratio;
        strNC=[num2str(red_ratio*100),'%'];
        
        set(handles.text10,'string',strNC);
        
        strNC1=('一級果');
        strNC2=('二級果');
        strNC3=('三級果');
        if r>1
            set(handles.text15,'string',strNC1);
        else if r>0.8&&r<1
                set(handles.text15,'string',strNC2);
            else
                set(handles.text15 ,'string',strNC3);
            end
        end
    case'   圓形度'
        
        
        x1=handles.X1;
        
        I2=rgb2gray(x1);
        
        J=im2bw(I2,0.75);
        
        I=~J;
        
        %====形態特征值計算===%
        l=bwlabel(I,8);
        
        [l,num]=bwlabel(I,8);
        
        STATS=regionprops(l,'Area');
        
        A=STATS.Area;
        
        STATS=regionprops(l,'Perimeter');
        
        L=STATS.Perimeter
        
        C=(4.*pi.*A)./(L.*L); % 計算圓度
        
        % L為周長,A為面積,C為圓形度
        
        strNC=[num2str(C)];
        
        set(handles.text12,'string',strNC);
        
        strNC1=('一級果');
        strNC2=('二級果');
        strNC3=('三級果');
        if C>0.65
            set(handles.text17,'string',strNC1);
        else if C>0.55&&C<0.65
                set(handles.text17,'string',strNC2);
            else
                set(handles.text17,'string',strNC3);
            end
        end
    case'   表面缺陷'
        
        
        x1=handles.X1;
        
        w=rgb2gray(x1);
        
        L=medfilt2(w);
        
        level=graythresh(L);
        
        bw=im2bw(L,level);
        
        
        X=imclearborder(bw,4); %去除圖像與邊界相連通,但更高亮的區域
        
        axes(handles.axes4);
        
        imshow(X)
        
        title('缺陷圖像');
        
        Q=(bwarea(X)/bwarea(~bw)*100)
        q=num2str(bwarea(X)/bwarea(~bw)*100)
        strNC=[q,'%'];
        
        set(handles.text11,'string',strNC);
        
        strNC1=('一級果');
        strNC2=('二級果');
        strNC3=('三級果');
        if Q<0.1
            set(handles.text16,'string',strNC1);
        else if Q>0.1&&Q<0.2
                set(handles.text16,'string',strNC2);
            else
                set(handles.text16,'string',strNC3);
            end
        end
end
guidata(hObject, handles);
% --- Executes during object creation, after setting all properties.
function popupmenu1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

檢測汽油儀_紙張水分儀檢測方法_水果檢測儀

三、運行結果

四、備注

版本:2014a

騰元達編輯,轉載請注明出處

標簽: 水果檢測儀
請往下拉!
主站蜘蛛池模板: 国产成人av一区二区三区在线观看 | 少妇太爽了在线观看| 欧美孕妇变态重口另类| 日韩国产精品无码一区二区三区 | 自拍偷在线精品自拍偷99| 亚洲av无码一区二区三区四区| 久久久老熟女一区二区三区| 最新国产av无码专区亚洲| 厨房玩丰满人妻hd完整版视频 | 国产精品jizz视频| 人妻中文字幕乱人伦在线| 久久国产精品免费一区| 野花社区视频www官网| 草草影院发布页| 亚洲一区二区三区尿失禁| 男女后进式猛烈xx00动态图片| 亚洲av永久中文无码精品综合| 国产精品丝袜黑色高跟鞋| 色欲老女人人妻综合网| 欧美精品欧美人与动人物牲交| 公交车大龟廷进我身体里视频| 男女上下猛烈啪啪免费看| 中文字幕亚洲乱码熟女一区二区| 我要看a级毛片| 最新亚洲人成无码网www电影| 国产在线精品一区二区中文| 欧美黑人又粗又大久久久| 高清破外女出血av毛片| 国产精品无码制服丝袜| 国产蜜臀av在线一区尤物| 大桥久未无码吹潮在线观看 | 欧美巨鞭大战丰满少妇| 国产精品ⅴ无码大片在线看| 巨人精品福利官方导航| 女人被狂躁c到高潮视频| 成人片黄网站色大片免费| 熟妇高潮一区二区三区 | 国产sp调教打屁股视频网站| 国产成本人片免费av| 精品久久久无码中文字幕边打电话 | 亚洲国产a∨无码中文777|