matlab gui matlab gui 鼠标点击显示图像颜色值

本文介绍如何创建一个MATLAB GUI,通过点击图像显示所选像素的颜色值。用户可以使用‘myfile’菜单打开图片,图像会显示在带有放大缩小功能的axes中。重点在于回调函数的编写,通过获取鼠标在axes的位置来获取像素颜色。
摘要由CSDN通过智能技术生成

首先看看效果

首先功能说明下,运行后通过myfile菜单打开一幅图片之后在axes中显示,由于要使用图片的放大缩小等功能将figure 的菜单栏与工具栏都一并打开了。

界面编程主要是callback函数编写,不多说了直接上代码

function varargout = mytest(varargin)
% MYTEST M-file for mytest.fig
%      MYTEST, by itself, creates a new MYTEST or raises the existing
%      singleton*.
%
%      H = MYTEST returns the handle to a new MYTEST or the handle to
%      the existing singleton*.
%
%      MYTEST('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in MYTEST.M with the given input arguments.
%
%      MYTEST('Property','Value',...) creates a new MYTEST or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before mytest_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are pas
  • 2
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值