首页 > 编程知识 正文

cytoscape拓扑分析教程,ransac算法图像匹配

时间:2023-05-04 18:35:11 阅读:172940 作者:3604

一:大致算法流程

1 .针对各像素点计算图像的x方向、y方向的2阶偏导数,计算图像的XY方向的导数

2 .根据第一步的计算结果,Hessian Matrix计算D(h) = Ixx*Iyy - Ixy*Ixy

这里Ixx表示x方向的二次偏导数

Iyy表示y方向的二次偏导数

IXY表在xy方向的二阶导数

3 .基于在步骤2中计算的值,使用33窗口实现除最大信号之外的冲压,

我的做法是直接提高了threshold值。 这其实不太对。 真的很懒,不想得到。

2 :导数计算的实现

关于一阶和二阶高斯偏导数的计算请看这里:

3358 blog.csdn.net/Jia 20003/article/details/16369143

三)程序效应

四:算法代码

package com.gloomy fish.image.Harris.corner; import Java.awt.image.buffered image; import java.util.ArrayList; import java.util.List; import com.gloomy fish.filter.study.abstractbufferedimageop; publicclasshessianfeaturedetectorextendsabstractbufferedimageop { privategaussianderivativefiltergdfilter; privatedoubleminrejectthreshold=4.1; //(R1 ) )2/rprivatelisthessianmatrixpixelmatrixlist; publichessianfeaturedetector ((GD filter=newgaussianderivativefilter ); pixelmatrixlist=newarraylisthessianmatrix (; } @ overridepublicbufferedimagefilter (bufferedimagesrc,BufferedImage dest ) {int width=src.getWidth; int height=src.getHeight (; initsettings(height,width ); if (dest==空) dest=createcompatibledestimage (src,空); int [ ] in pixels=new int [ width * height ]; GD filter.setdirectiontype (gaussianderivativefilter.xx _ direction ); bufferedimagebixx=GD filter.filter (src,null ); getRGB(bixx,0,0,width,height,inPixels ); extractpixeldata(inpixels,gaussianderivativefilter.xx _ direction,height,width ); //yydirectiongdfilter.setdirectiontype (gaussianderivativefilter.YY _ direction ); bufferedimagebiyy=GD filter.filter (src,null ); getRGB(biyy,0,0,width,height,inPixels ); extractpixeldata(inpixels,gaussianderivativefilter.YY _ direction,height,width ); //xydirectiongdfilter.setdirectiontype (gaussianderivativefilter.xy _ direction ); bufferedimagebixy=GD filter.filter (src,null ); getRGB(bixy,0,0,width,height,inPixels ); extractpixeldata(inpixels,gaussianderivativefilter.xy _ direction,height,width ); int [ ] out pixels=new int [ width * height ]; int index=0; for(introw=0; rowheight; row}{intta=0,tr=0,tg=0,tb=0; for (内部=0; colwidth; col}{index=row*widthcol; ta=255; hessianmatrixhm=pixelmatrixlist.get (index ); double[] t=hm.getThreshold (; if (t [0] minrejectthreshold ({ tr=127; } else { tr=0; (if ) t[1]minrejectthreshold ) { tg=127; } else { tg=0; (if ) t )2) minrejectthreshold ) { tb=127; } else { tb=0; }outpixels[index]=(ta24 )|) tr16(|TG8(|TB; }setRGB(dest,0,0,width,height,outPixels ); return dest; } privatevoidinitsettings (int height,int width ) { int index=0; for(introw=0; rowheight; row () for ) intcol=0; colwidth; col}{index=row*widthcol; hessianmatrixmatrix=newhessianmatrix (; pixelmatrixlist.add(index,matrix ); } } privatevoidextractpixeldata (int [ ] pixels,int type,int height,int width ) { int index=0; for(introw=0; rowheight; row}{intta=0,tr=0,tg=0,tb=0; for (内部=0; colwidth; col}{index=row*widthcol; ta=(Pixels[index]24 )0xff; tr=(Pixels[index]16 )0xff; TG=(Pixels[index]8)0xff; tb=pixels[index]0xff; hessianmatrixmatrix=pixelmatrixlist.get (index ); if (type==gaussianderivativefilter.xx _ direction ) matrix.setxx(newdouble[]{tr,tg,tb} ); }类型==gaussianderivativefilter.YY _ direction ) matrix.setYY(newdouble[]{tr,tg,tb} ); }类型==gaussianderivativefilter.xy _ direction ) matrix.setxy(newdouble[]{tr,tg,tb} ); } } }}} 转载请注明!

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。