提取raw图像边缘的程序,请大家帮忙看一下,帮帮我这只可怜的菜鸟(分不够可以再加哦)
本人是只超级菜鸟,只有一点C语言的经验,刚接触VC++,感觉是雾里看花呀……
现在我需要提取一幅图像的边缘显示在新图像中,我从一本书上查到一个程序:
//程序名:cut_apart_1
//程序功能:运用Laplacian算子分割图像
//Button1.caption="打开图像"
//Button2.caption="转化成灰度图像"
//Button3.caption="Laplacian算子法分割"
//Image1.name=Image1
//Image2.name=Image2
//TPogressBar1.name=ProgressBar1
//OpenDialog1.name=OpenDialog1
//头文件f411_2.h
#ifndef f411_2H
#define f411_2H
#include<Classes.hpp>
#include<Controls.hpp>
#include<StdCtrls.hpp>
#include<Forms.hpp>
#include<Dialogs.hpp>
#include<ExtCtrls.hpp>
#include<math.h>
#include<Menus.hpp>
#include<Buttons.hpp>
#define MaxLenth 350000
class TForm1:bublic TForm
{
_published://IDE-managed Components
TOpendialog*OpenPictureDialog1;
TImage*Image1;
TButton*Button1;
TProgressBar *ProgressBar1;
TButton*Button2;
TImage*Image2;
TBitBtn*BitBtn1;
Void_fastcall Button1Click(TObject*Sender);
Void_fastcall Button2Click(TObject*Sender);
Void_fastcall Button3Click(TObject*Sender);
Private://User declarations
Public: //User declarations
_fastcall TForm1(TComponent*Owner);
};
extern PACKAGE TForm1*Form1;
#endif
class PictureOperation
{
public:
int PictureWidth;
int PictureHeight;
int GreyDegree[MaxLenth];
int NewGreyDegreen[MaxLenth];
public:
void ColorPicture_To_GreyPicture(Timage*Image1);
void Device_With_Laplacian(Timage*OutputImage);
void PictureOperaton::ColorPicture_To_GreyPicture(TImage*Image1);
{
int x,y;
int color;
int R,G,B;
int Y;
PictureWidth=Image1->Width;
PictureHeight=Image1->Height;
ProgressBar1->Visible=true;
ProgressBar1->Max=PcitureHeight;
ProgressBar1->Min=0;
if(PictureWidth*PcitureHeight<MaxLenth)
{
for(y=0;y<PictureHeight;y++)
{
for(x=0;y<PictureWidth;x++)
{
color=Image1->Canvas->Pixels[x][y];
R=color&255;
G=(color/256)&255;
B=(color/256/256)&255;
Y=0.3*R+0.59*G+0.11*B;
GreyDegree[y*PictureWidth+x]=Y;
Image1->Canvas->Pixel[x][y]=RGB(Y,Y,Y)
}
ProgressBar1->Position++;
}
}
ProgressBar1->Visible=false;
}
void PictureOperation::Device_With_Laplacian(TImage*OutputImage)
{
int x,y;
int new_grey;
OutputImage->Width=PictureWidth;
OutputImage->Height=PictureHeight;
ProgressBar1->Visible=true;
ProgessBar1->Max=PictureHeight;
ProgressBar1->Min=0;
ProgressBar->Position=0;
for(y=1;y<PictureHeight-1;y++);
{
for(x=1;x<PictureWidth-1;x++)
{
new_grey=GreyDegree[(y-1)*PcitureWidth+(x)]+GreyDegree[(y+1)*PictureWidth+(x)]+GreyDegree[(y-1)*PcitureWidthO+(x-1)]+GreyDegree[(y)*PcitureWidth+(x+1)]-4*GreyDegree[(y)IPcitureWidth+(x)];
if(new_grey<0)new_Ogrey=-new_grey;
OutputImage1->Canvas->Pixel[x][y]=RGB(new_grey,new_grey,new_grey);
}
ProgressBar1->Position++;
}
ProgressBar1->Visible=false;
}
//f411_2.cpp
#include<vc1.h>
#pragma hdrstop
#include "c2.h"
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm *Form1;
PictureOperation PictureProcessing;
_fastcall TForm1::TForm1(TComponent*Owner):TForm(Owner)
{
}
Void_fastcall TForm1::Button1Click(TObject*Sender)
{
if(OpenPictureDialog1->Execute()==true)
{
Image1->Pciture->LoadFromFile(OpenPictureDialog1->FileName);
}
}
Void_fastcall TForm1::Button3Click(TObject*Sender)
{
Image1->Visible=false;
PictureProcessing.ProgressBar1=ProgressBar1;
PictureProcessing.Device_With_Laplacian(Image2);
}
Void_fastcall TForm1::Button2Click(TObject*Sender)
{
PictureProcessing.ProgressBar1=ProgressBar1;
PictureProcessing.ColorPicture_To_GreyPicture(Image1);
}
我把它作为c1.cpp和c2.cpp文件放在工程的Source Files中,出现了一些问题:
编译时系统总说找不到include中的*.h和*.hpp文件,像Classes.hpp、vc1.h等。而且我也不知道这个程序能不能对RAW图像文件进行边缘提取
谁有对RAW图像文件进行边缘检测、滤除噪声和平滑所得边缘的源代码,请发到我的邮箱:lhxm007@sina.com中,感激不尽!!!(给点建议也有分哦)