Halcon機(jī)器視覺實(shí)驗(yàn)指導(dǎo)書_第1頁
Halcon機(jī)器視覺實(shí)驗(yàn)指導(dǎo)書_第2頁
Halcon機(jī)器視覺實(shí)驗(yàn)指導(dǎo)書_第3頁
Halcon機(jī)器視覺實(shí)驗(yàn)指導(dǎo)書_第4頁
Halcon機(jī)器視覺實(shí)驗(yàn)指導(dǎo)書_第5頁
已閱讀5頁,還剩215頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

2HDevelop

HALCON

1HALCON

2HDevelop

3HALCON

4HALCON

5HALCON

6HALCON

7HALCON

8HALCON3D

1HALCON

1

:stamps.dev

5.1

(,

,

)

OCR

OCR

5.1:Michel.

,

HDevelop

dev_close_window()

read_image(Catalog,’swiss1.tiff’)

get_image_pointer1(Catalog,Pointer,Type,Width,Height)

dev_open_window(0,0,Width/2,Height/2,’black’,WindowID)

dev_set_part(0,0,Height-1,Width-1)

dev_set_draw(’fill’)

threshold(Catalog,Dark,0,110)

dev_set_colored(6)connection(Dark,

(ConnectedRegions,

ConnectedRegions)fill_up

RegionFillUp)select_shape

(RegionFillUp,StampCandidates,’area’,

’and’,10000,200000)

select_shape(StampCandidates,

Stamps,’compactness’,’and’,1,1.5)

smallest_rectangle1(Stamps,Row1,Column1,Row2,Column2)

dev_display(Catalog)

dev_set_draw(’margin’)

dev_set_line_width(3)

disp_rectangle1(WindowID,Row1,Column1,Row2,Column2)

threshold

connection

selectshape

smallestrectangle1

(

:'

(

')

/)

.

5.2

2

:vessel.dev

5.3()

,,

:

,

HALCON

”el”5×5

5.3

5.4

5.4:()()

21161

read_image(Image,’vessel’)

texture_laws(Image,Texture,’el’,5,

5)

mean_image(Texture,Energy,211,

61)

bin_threshold(Energy,Vessel)

,

binthreshold

5.4

3

:particle.dev

5.5

5.5:()

,

,

---

---

:

read_image(Particle,’particle’)

threshold(Particle,Large,110,255)

110

5.5

n

,

,

1531

(3)

mean_image(Particle,Mean,31,31)

dyn_threshold(Particle,Mean,Small,3,’light’)

dynthreshold5.6

,.

connection(Small,SmallSingle)

select_shape(SmallSingle,ReallySmall,’area’,’and’,1,300)

selectshape

dilation_circle(Large,LargeDilation,8.5)

complement(LargeDilation,NotLarge)

reduce_domain(Particle,NotLarge,ParticleRed)

mean_image(ParticleRed,Mean,31,31)

dyn_threshold(ParticleRed,Mean,Small,3,’light’)

5.6

5.6

dilation_circle(Large,LargeDilation,8.5)

complement(LargeDilation,NotLarge)

reduce_domain(Particle,NotLarge,ParticleRed)

mean_image(ParticleRed,Mean,31,31)

dyn_threshold(ParticleRed,Mean,Small,3,’light’)

5.6

opening

opening_circle(Small,SmallClean,2.5)

opening2.5

5.7

getmbutton

5.7

dev_clear_window(WindowID)

connection(SmallClean,SmallSingle)

Button:=1

dev_set_color(’red’)

while(Button=1)

get_mbutton(WindowID,Row,Column,Button)

select_region_point(SmallSingle,OneObject,Row,Column)

devclearwindowconnection

HDevelop

button1

4

wood.dev

dynthreshold

15x15

connectionselectshape

5.8

5.8

genregionline

HALCON

intersection

x-y-

dev_close_window()

read_image(WoodPiece1,’woodring’)

get_image_pointer1(WoodPiece1,Pointer,Type,Width,Height)

dev_open_window(0,0,Width/2,Height/2,’black’,WindowID)

mean_image(WoodPiece1,ImageMean,9,9)dyn_threshold

(WoodPiece1,ImageMean,Regions,5.0,’dark’)threshold

(WoodPiece1,Dark,0,90)

dilation_rectangle1(Dark,DarkDilation,30,7)

difference(Regions,DarkDilation,RegionBright)

connection(RegionBright,ConnectedRegions)

select_shape(ConnectedRegions,

SelectedRegions,

’area’,’and’,30,10000000)

get_mbutton(WindowID,Row1,Column1,Button1)

get_mbutton(WindowID,Row2,Column2,Button2)gen_region_line(Line,Row1,Column1,Row2,Column2)intersection(Line,SelectedRegions,Inters)connection(Inters,ConnectedInters)

Number:=|ConnectedInters|

5

ball.dev

5.9

5.9

read_image(Bond,’die3’)

threshold(Bond,Bright,120,255)

shape_trans(Bright,Die,’rectangle2’)

fillupshape

reduce_domain(Bond,Die,DieGray)threshold(DieGray,Wires,0,100)

fill_up_shape(Wires,WiresFilled,’area’,1,100)

opening_circle(WiresFilled,Balls,15.5)

connection(Balls,SingleBalls)

select_shape(SingleBalls,IntermediateBalls,’circularity’,and,0.85,1.0)sort_region(IntermediateBalls,FinalBalls,’FirstPoint’,’True’,’column’)smallest_circle(FinalBalls,Row,Column,Radius)

opening15.5

shape5.10

5.10

NumBalls:=|Radius|Diameter:=2*Radius

MeanDiameter:=sum(Diameter)/NumBalls

MinDiameter:=min(Diameter)

6

calib.dev

CCD

5.11

5.11grayinside

grayinside

fuzzy

fuzzy

grayinside

grayinside

5.11

read_image(Caltab,’caltab’)

gauss_image(Caltab,ImageGauss,9)

gray_inside(ImageGauss,ImageDist)

threshold(ImageDist,Bright,110,255)

connection(Bright,Circles)

elliptic_axis(Circles,Ra,Rb,Phi)

ellipticaxis

7

5.12

5.12HSV

RGB

5.12

HSV

selectshape

read_image(ICs,’ic’)

decompose3(ICs,Red,Green,Blue)

trans_from_rgb(Red,Green,Blue,Hue,Saturation,Intensity)

threshold(Saturation,Colored,100,255)

reduce_domain(Hue,Colored,HueColored)

threshold(HueColored,Blue,114,137)

connection(Blue,BlueConnect)

select_shape(BlueConnect,BlueLarge,’area’,’and’,150,100000)

shape_trans(BlueLarge,Condensators,’rectangle2’)

threshold(HueColored,Red,10,19)

connection(Red,RedConnect)

select_shape(RedConnect,RedLarge,’area’,’and’,150,100000)

shape_trans(RedLarge,Resistors,’rectangle2’)

5.13

5.13ic

ic

IC

IC

ICIC

IC

IC

threshold(Intensity,Dark,0,50)

dilation_rectangle1(Dark,DarkDilate,15,15)

connection(DarkDilate,ICLarge)

add_channels(ICLarge,Intensity,ICLargeGray)

threshold(ICLargeGray,ICsDark,0,50)

shape_trans(ICsDark,IC,’rectangle2’)

5.13

reducedomain

IC

addchannels

threshold

IC

IC

5.14

5.14

IC

ICIC

IC

X:=20

dilation_rectangle1(IC,ICWidth,5,1)difference(ICWidth,IC,SearchingArea)

dilation_rectangle1(SearchingArea,SearchingAreaWidth,14,1)

union1(SearchingAreaWidth,SearchingAreaUnion)

reduce_domain(Intensity,SearchingAreaUnion,

SearchGray)

mean_image(SearchGray,Mean,15,15)

dyn_threshold(SearchGray,Mean,Contacts,5,’light’)

connection(Contacts,ContactsConnect)

fill_up(ContactsConnect,ContactsFilled)

select_shape(ContactsFilled,ContactsRes,’area’,’and’,10,100)

selectshape

5.14

8

5.15

X

getimagepoint1

X

areaenter

read_image(WoodCells1,’woodcell’)

threshold(WoodCells1,CellBorder,0,120)

get_image_pointer1(WoodCells1,Pointer,Type,Width,

Height)open_file(’wood_cells.dat’,’output’,FileHandle)

fori:=0toWidth-X-1by1

clip_region(CellBorder,Part,0,i,Height-1,i+X)

area_center(Part,Area,Row,Col)

fwrite_string(FileHandle,i+’’+(Area*100.0/(X*Height)))fnew_line(FileHandle)

endfor

close_file(FileHandle)

5.16

5.16

openfiletxt

fwritestringfnewlinefwritestring

+

5.16

9

HALCON

5.17

selectshape5

dev_close_window()

read_image(Image,’monkey’)threshold

(Image,Region,128,255)

connection(Region,ConnectedRegions)

select_shape(ConnectedRegions,CompactRegions,

’compactness’,’and’,1.5,1.8)

Number:=|CompactRegions|

Eyes:=[]

fori:=1toNumberby1SingleSelected:=

CompactRegions[i]

area_center(SingleSelected,Area,Row,Column)

dev_set_color(’green’)

if((Area>500)and(Area<50000))

dev_set_color(’red’)

Eyes:=[SingleSelected,Eyes]

endif

endfor

number

i

(omcatobj)

concatobj

countobj0

(selectobj)

Eyes

emptyobject

obj

Eyes

menufile

10

HDevelop

HDevelopdeverrorvardevsetcheck

getmpositiongetgrayvalHDevelopgetmposition

HMSGFAL

read_image(Image,’mreut’)

11

dev_close_window()

dev_open_window(0,0,-1,-1,’black’,WindowID)

dev_display(Image)

Button:=1

while(Button#4)

dev_error_var(Error,1)

dev_set_check(’~give_error’)

get_mposition(WindowID,Row,Column,Button)

dev_error_var(Error,0)

dev_set_check(’give_error’)if

(Error=H_MSG_TRUE)

get_grayval(Image,Row,Column,Grayval)

dev_set_color(’black’)

disp_rectangle1(WindowID,0,0,22,85)

dev_set_color(’white’)set_tposition

(WindowID,15,2)

write_string(WindowID,’(’+Row+’,’+Column+’)=’+Grayval)

endif

endwhile

getmposition

Devsetcheck

devsetcheckHDevelop

deverrorvargetmposition

2.y

3.

HALCON

512x512

20ms

5.18

5.18

1.

5.18

5.19

5.19

HDevelop

MinSize:=30

set_system(’init_new_image’,’false’)

read_image

(Motorway,’motorway’)

count_seconds(Seconds1)

gen_grid_region(Grid,MinSize,MinSize,’lines’,512,512)

clip_region(Grid,GridRoad,130,10,450,

502)reduce_domain(Motorway,GridRoad,

Mask)sobel_amp(Mask,

Gradient,’sum_abs’,3)threshold(Gradient,

Points,40,255)

dilation_rectangle1(Points,RegionDilation,MinSize,MinSize)

reduce_domain(Motorway,RegionDilation,SignsGray)

threshold(SignsGray,Signs,190,

255)count_seconds(Seconds2)

Time:=Seconds2-Seconds1

dev_display(Signs)

5.19

gengridregion

reducedomain

threshold

clipregion

sobelamp

HALCON

1.

2.

3.

4.

20ms

#include"HalconCpp.h"

3

3.1

HALCON

HALCON

3.1

3.2C++

3.1

Mandrill8

128

0255HALCON

anisometry

C++

HALCON

3.1

main()

{

usingnamespaceHalcon;

HImageMandrill("monkey");//readimagefromfile"monkey"

HWindoww;//windowwithsizeequaltoimage

Mandrill.Display(w);//displayimageinwindow

w.Click();//waitformouseclick

HRegionBright=Mandrill>=128;//selectallbrightpixels

HRegionArrayConn=Bright.Connection();//getconnectedcomponents

//selectregionswithasizeofatleast500pixels

HRegionArrayLarge=Conn.SelectShape("area","and",500,90000);

//selecttheeyesoutoftheinstancevariableLargebyusing

//theanisometryasregionfeature:

HRegionArrayEyes=Large.SelectShape("anisometry","and",1,1.7);

Eyes.Display(w);//displayresultimageinwindow

w.Click();//waitformouseclick

}

3.2:.

5.1.1.1

HRegionArray

HRegionArray

HRegionArray

4.2.2

5.1HRegion

5.2(mreut.png)

reg,

HALCON

Intersection,Difference,

,

HRegion

open

difference

HRegionArrayUnion1,

HRegionArray

HRegionArray

5.3HRegionArray

5.3HRegionArray

5.4HALCON

1000

1.5

rect

for

5.4

(fabrik.png)

5.4

5.1.2

HALCON

HALCON

HALCON

HALCON

5.1.2.2

HImage

4.2.2

5.5

HImage

(

HImage

HALCON

16

HALCON

HImage

),

8

32

HRegion

threshold.

HRegion

5.5HImage

(operator&)

>=

61*61

5.65.5

5.6(mreut.png)

5.1.2.2

double

5.7HPixVal

HPixVal(constHPixVal&Val)

HPixVal&operator=(constHPixVal&grey)

operatorHByte(void)const(0...255)

operatorint(void)const

operatorlong(void)const

operatordouble(void)constdouble

operatorHComplex(void)const

5.7HPixVal

xy

HALCON/C

HALCON/C

,

C

HALCON

HALCON

C

HALCON

HALCON/C

HALCON

C

109

15

:

9312

HALCONtuples(tuples:

105

C

HALCON

97

tuples,

103

14

12.2.2

13

)

,

111

11.1C

11.1

128

HALCON

,

,

:

HALCON

HALCON

C

:

tuple

HALCON

,

,

()

#include"HalconC.h"

main()

{

5HALCON

Hobjectmandrill,thresh,conn,area,eyes;/*requiredobjects*/

longWindowHandle;

open_window(0,0,512,512,0,"visible","",&WindowHandle);/*openwindow*/

read_image(&mandrill,"monkey");/*readinputimage("monkey")*/

disp_image(mandrill,WindowHandle);/*displayinputimage*/

get_mbutton(WindowHandle,_,_,_);/*waitformouseclick*/

/*Selectimageregionwithpixelsin[128,255]*/

threshold(mandrill,&thresh,128.0,255.0);

connection(thresh,&conn);/*computeconnectedcomponents*/

/*selectregionswithanareaofatleast500pixels*/

select_shape(conn,&area,"area","and",500.0,90000.0);

/*selecttheeyesintheseregionsbyusingtheanisometryfeature*/

select_shape(area,&eyes,"anisometry","and",1.0,1.7);

disp_region(eyes,WindowHandle);/*displayresult*/

get_mbutton(WindowHandle,_,_,_);/*waitformouseclick*/

close_window(WindowHandle);/*closewindow*/

/*deleteimageobjectsfromtheHalcondatabase*/

clear_obj(mandrill);clear_obj(thresh);clear_obj(conn);

clear_obj(area);clear_obj(eyes);

}

11.1:()()

4HALCON

6HALCON

7HALCON

8HALCON3D

hdevelop\measureswitch.dev1a

1

a

1b

rectangle2

gen_measure_rectangle2(Row,Column,

Phi,Length1,Length2,Interpolation,MeasureHandle)

measure_pairs(IntraDistance)

InterDistance)

b

gen_measure_

,

(

measure_pairs(Image,MeasureHandle,Sigma,Threshold,Transition,Select,

RowEdgeFirst,ColumnEdgeFirst,AmplitudeFirst,

RowEdgeSecond,ColumnEdgeSecond,AmplitudeSecond,

IntraDistance,InterDistance)

2

2

HDevelop

printIC

hdevelop\first_example_shape_matching.dev

Run

------------------------

Step1:

Row1:=188

Column1:=182

Row2:=298

Column2:=412

gen_rectangle1(ROI,Row1,Column1,Row2,Column2)

reduce_domain(ModelImage,ROI,ImageROI)

-----------------------------

gen_rectangle1

drawretangle1

.

.

1.

reducedomain,

------------------------------------------

Step2

inspect_shape_model(ImageROI,ShapeModelImages,ShapeModelRegions,8,30)

create_shape_model(ImageROI,NumLevels,0,rad(360),’auto’,’none’,

’use_polarity’,30,10,ModelID)

creatshapemodel,,,

.,inspectshapemodel,

.

d)

2

Inspectshapemodel

1

(4

pyrami

:

pyramid

inspectshapemodel

createshapemodelContrast.AngleStartAngleExtent)Optimization,

,,

.

pyramid,1;

.

,

NumLevels

,angles(

angle(AngleStep).

,,

.Metric

,

,

.

.,

(MinContrast).

,creatshapemodel

,

HALCON’sCOMHShapeModel,

.

model;,

.

------------------------------------

:

C++

,

,

(ModeIID),

findshapemodel.,

HShapeModelX

creatscaledshape

(

3

angles)

Step3:

fori:=1to20by1

grab_image(SearchImage,FGHandle)

find_shape_model(SearchImage,ModelID,0,rad(360),0.7,1,0.5,

’least_squares’,0,0.9,RowCheck,ColumnCheck,

AngleCheck,Score)

endfor

-----------------------------------------

128

,findshapemodel;

2.ModelID,findshapemodel

:AngleStart,AngleExtentNumLevels,

,

NumLeves0,

;0.5,

,

(MaxOverlap).

,SubPixel0.,

,””(0)”

203.

findshapemodel

AngleScore,,,

findscaledshapemodel(

),Scale

;

.MinScore,

(NumMatches)

Greediness

”(1).

,ROW,Column

.

createscaledshapemodel

.

111

11.1

C

11.1

:,

HALCON

,

,

:

HALCON

HALCON

C

tuple

HALCON

,

()

#include"HalconC.h"

main()

{

Hobjectmandrill,thresh,conn,area,eyes;/*requiredobjects*/

longWindowHandle;

open_window(0,0,512,512,0,"visible","",&WindowHandle);/*openwindow*/

read_image(&mandrill,"monkey");/*readinputimage("monkey")*/

disp_image(mandrill,WindowHandle);/*displayinputimage*/

get_mbutton(WindowHandle,_,_,_);/*waitformouseclick*/

/*Selectimageregionwithpixelsin[128,255]*/

threshold(mandrill,&thresh,128.0,255.0);

connection(thresh,&conn);/*computeconnectedcomponents*/

/*selectregionswithanareaofatleast500pixels*/

select_shape(conn,&area,"area","and",500.0,90000.0);

/*selecttheeyesintheseregionsbyusingtheanisometryfeature*/

select_shape(area,&eyes,"anisometry","and",1.0,1.7);

disp_region(eyes,WindowHandle);/*displayresult*/

get_mbutton(WindowHandle,_,_,_);/*waitformouseclick*/

close_window(WindowHandle);/*closewindow*/

/*deleteimageobjectsfromtheHalcondatabase*/

clear_obj(mandrill);clear_obj(thresh);clear_obj(conn);

clear_obj(area);clear_obj(eyes);

}

11.1:()()

9

HALCON

5.17

selectshape5

dev_close_window()

read_image(Image,’monkey’)threshold

(Image,Region,128,255)

connection(Region,ConnectedRegions)

select_shape(ConnectedRegions,CompactRegions,

’compactness’,’and’,1.5,1.8)

Number:=|CompactRegions|

Eyes:=[]

fori:=1toNumberby1SingleSelected:=

CompactRegions[i]

area_center(SingleSelected,Area,Row,Column)

3.5a

dev_set_color(’green’)

if((Area>500)and(Area<50000))

dev_set_color(’red’)

Eyes:=[SingleSelected,Eyes]

endif

endfor

number

i

(omcatobj)

concatobj

countobj0

(selectobj)

Eyes

emptyobject

obj

Eyes

menufile

3.3.4.1

3.5abcblob

read_image

mean_image

dyn_threshold8

connection3.5b

read_image(Image,’crystal’)

mean_image(Image,ImageMean,21,21)

dyn_threshold(Image,ImageMean,RegionDynThresh,8,’dark’)

connection(RegionDynThresh,ConnectedRegions)

select_shape

select_gray

3.5c

crystalsremain(seefigure3.5c).

shape_trans(ConnectedRegions,ConvexRegions,’convex’)select_shape(ConvexRegions,LargeRegions,’area’,’and’,600,2000)select_gray(LargeRegions,Image,Crystals,’entropy’,’and’,1,5.6)

3.3.4.2

examples\quickguide\hdevelop\atoms.dev

p-n

3.6

gauss_image(Image,ImageGauss,5)

watersheds(ImageGauss,Basins,Watersheds)

select_shape(Basins,SelectedRegions1,’column1’,’and’,2,Width-1)select_shape(SelectedRegions1,SelectedRegions2,’row1’,’and’,2,Height-1)select_shape(SelectedRegions2,SelectedRegions3,’column2’,’and’,1,Width-3)select_shape(SelectedRegions3,Inner,’row2’,’and’,1,Height-3)

select_shape(Inner,Irregular,’compactness’,’and’,1.45,3)

3.6

3.2.4.1

3.23D

a)b)

3.2aROIb

dev_open_window

draw_regionreduce_domain

draw_region(Region,WindowHandle)

reduce_domain(Image,Region,ImageReduced)

critical_points_sub_pix

critical_points_sub_pix(ImageReduced,’facet’,1.5,8,_,_,_,_,RowSaddle,ColSaddle)

dev_clear_window()

dev_display(ImageReduced)

dev_set_color(’yellow’)

fori:=0to|RowSaddle|-1by1

gen_cross_contour_xld(Cross,RowSaddle[i],ColSaddle[i],25,0.785398)

dev_display(Cross)

draw_region,

ROI

endfor

3.2.4.2

examples\quickguide\hdevelop\medianinteractive.dev

3.3

get_mposition

dev_set_check

Button:=0

while(Button#4)

Row:=-1

Column:=-1

dev_set_check(’~give_error’)

get_mposition(WindowHandle,Row,Column,Button)

dev_set_check(’give_error’)

if(Row>=0andColumn>=0)

gen_circle(Circle,Row,Column,20)

boundary(Circle,RegionBorder,’inner’)

dev_display(RegionBorder)

gen_circle

if(Button=1)

reduce_domain(Image,Circle,ImageReduced)

median_image

reduce_domain

median_image(ImageReduced,ImageMedian,’circle’,5,’mirrored’)

overpaint_gray(Image,ImageMedian)

endif

3.5.4.1

3.10

3.6

edges_image

(”nms”)

(2040)

1

splitskeletonlines

XLD

1

HALCON

64

XLD

HALCON

3.11ab

84

2

3.12

3.12:a

ROIs

b

c

ROIs

ROIs

ROIs

3.12

threshold(Image,Dark,0,128)

connection(Dark,DarkRegions)

select_shape(DarkRegions,Circles,[’circularity’,’area’],’and’,

[0.85,50],[1.0,99999])

boundary(Circles,RegionBorder,’inner’)

dilation_circle(RegionBorder,RegionDilation,6.5)

union1(RegionDilation,ROIEdges)

reducedomainchanges

3.12b

reduce_domain(Image,ROIEdges,ImageROI)

edges_sub_pix(ImageROI,Edges,’lanser2’,0.3,10,30)

fit_ellipse_contour_xld

gen_ellipse_contour_xld3.12b3.12c

fit_ellipse_contour_xld(Edges,’ftukey’,-1,2,0,200,3,2,Row,Column,

Phi,Ra,Rb,StartPhi,EndPhi,PointOrder)NumHoles:=|Ra|gen_ellipse_contour_xld(ContEllipse,Row,Column,Phi,Ra,Rb,

gen_tuple_const(NumHoles,0),gen_tuple_const(NumHoles,rad(360)),

gen_tuple_const(NumHoles,’positive’),1)

write_stringfori:=0toNumHoles-1by1write_string(WindowID,’D1=’

(WindowID,’D2=’+2*Rb[i])

endfor

3.12c

+2*Ra[i])write_string

3

3.16

3.16

edges_sub_pix(Image,Edges,’lanser2’,0.5,40,90)

segment_contours_xld(Edges,ContoursSplit,’lines_circles’,6,4,4)

sort_contours_xld(ContoursSplit,SortedContours,’upper_left’,’true’,

’column’)

count_obj

select_obj

HDevelop

HDevelop

get_contour_global_attrib_xld

distance_pp

NumSegments:=|SortedContours|

fori:=1toNumSegmentsby1

SingleSegment:=SortedContours[i]

get_contour_global_attrib_xld(SingleSegment,’cont_approx’,Attrib)

if(Attrib=1)

fit_circle_contour_xld(SingleSegment,’atukey’,-1,2,0,5,2,Row,

Column,Radius,StartPhi,EndPhi,PointOrder)

gen_ellipse_contour_xld(ContEllipse,Row,Column,0,Radius,Radius,

0,rad(360),’positive’,1.0)

else

fit_line_contour_xld(SingleSegment,’tukey’,-1,0,5,2,RowBegin,

ColBegin,RowEnd,ColEnd,Nr,Nc,Dist)

gen_contour_polygon_xld(Line,[RowBegin,RowEnd],[ColBegin,ColEnd])distance_pp(RowBegin,ColBegin,RowEnd,ColEnd,Length)

endif

endfor

4

3.18

create_shape_model

find_shape_model

read_image(Image,’clip’)

gen_rectangle2(ROI,124,181,0.653,129,47)

reduce_domain(Image,ROI,ImageReduced)

create_shape_model(ImageReduced,0,0,rad(360),0,’no_pregeneration’,’use_polarity’,40,10,ModelID)

find_shape_model(Image,ModelID,0,rad(360),0.7,13,0.5,

’interpolation’,0,0.9,Row,Column,Angle,Score)

get_shape_model_contours(ModelContours,ModelID,1)

fori:=0to|Row|-1by1

vector_angle_to_rigid(0,0,0,Row[i],Column[i],Angle[i],HomMat2D)

affine_trans_contour_xld(ModelContours,ContoursAffinTrans,HomMat2D)endfor

clear_shape_model(ModelID)

5

:examples\quickguide\hdevelop\colorpieces.dev

,

.

.

.

.,

,

,

(MLP

.

.

).

.

,

,

,.

(3.28a).draw_rectangle1gen_rectangle1

.tuple?Classes,.

read_image(Image,ImageRootName+’0’)

fori:=1to4by1

dev_display(Image)

dev_display(Classes)

set_tposition(WindowHandle,24,12)

write_string(WindowHandle,’Dragrectangleinside’+Regions[i-1]+

’color.Clickrightmousebuttontoconfirm.’)draw_rectangle1(WindowHandle,Row1,Column1,Row2,Column2)gen_rectangle1(Rectangle,Row1,Column1,Row2,Column2)

Classes:=[Classes,Rectangle]

endfor

,create_class_mlp.add_samples_image_class_mlp

.train_class_mlp.

.

create_class_mlp(3,4,4,’softmax’,’normalization’,3,42,MLPHandle)add_samples_image_class_mlp(Image,Classes,MLPHandle)

set_tposition(WindowHandle,100,12)

write_string(WindowHandle,’Training...’)

train_class_mlp(MLPHandle,200,1,0.01,Error,ErrorLog)

,,classify_image_class_mlp..

forimg:=0to3by1

read_image(Image,ImageRootName+img)

classify_image_class_mlp(Image,ClassRegions,MLPHandle,0.5)

stop()

endfor

blob.()copy_obj.

connection,(select_size).

,.

forfigure:=1to3by1

copy_obj(ClassRegions,ObjectsSelected,figure,1)

connection(ObjectsSelected,ConnectedRegions)

select_shape(ConnectedRegions,SelectedRegions,’area’,’and’,400,99999)

Number:=|SelectedRegions|

dev_set_color(Highlight[figure-1])

dev_display(SelectedRegions)

dev_set_color(’black’)

set_tposition(WindowHandle,24+30*figure,12)

write_string(WindowHandle,Regions[figure-1]+’:’+Number)

write_string(WindowHandle,’’)

dev_set_color(’green’)

if(Number#4)

dev_set_color(’red’)

write_string(WindowHandle,’N’)

endif

write_string(WindowHandle,’OK’)

dev_set_color(’black’)

endfor

,

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論