求助!vb与matlab混合编程,读图像的
我想在vb调用matlab的dll,并把处理后的图片显示在Image2.Picture上,代码应该怎样修改,谢谢
m代码:
function result=imagezq(x,i)
global result;
switch i
case 1
result=histeq(x);%直方图均衡
case 2
result=imadjust(x,[],[.25 1]);%图像增亮
case 3
result=imadjust(x,[],[0 .75]);%图像变暗
case 4
result=imadjust(x,[.25 .75],[]);%增加对比度
case 5
result=imadjust(x,[],[.25 .75]);%降低对比度
otherwise
warning('Invalid operation');
end
imshow(result);
VB代码:
Private st As pan.pan '定义类实例
Private Sub Command2_Click()
Dim x As Variant
x = Image1.Picture
i = 4
Call st.imagezq(1, result, x, i) 这里出问题
Image2.Picture = x
End Sub
'窗体装载时,创建新的类变量
Private Sub Form_Load()
Set st = New pan.pan
End Sub
'打开图像显示在Image1图像框中
Private Sub Command1_Click()
CommonDialog1.Filter = "(*.JPG)|*.jpg"
CommonDialog1.ShowOpen
FileName = CommonDialog1.FileName
Image1.Picture = LoadPicture(FileName)
End Sub