22.01.2015 Views

HDevelop User's Manual

HDevelop User's Manual

HDevelop User's Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

112 CHAPTER 5. PROGRAM EXAMPLES<br />

In some applications it is necessary to have explicit control over the result state of an operator.<br />

By default <strong>HDevelop</strong> stops if an operator returns a different state than À ÅË ÌÊÍ and gives<br />

an error message. To have explicit control over the result state, two <strong>HDevelop</strong> operators are<br />

available: Ú ÖÖÓÖ ÚÖ and Ú ×Ø . The following example shows how to use<br />

these operators.<br />

The task is to get online information about the position of the mouse inside a graphics window<br />

and to display the gray value at this position. This can be achieved using the two operators<br />

Ø ÑÔÓ×ØÓÒ and Ø ÖÝÚÐ. The problem with Ø ÑÔÓ×ØÓÒ in <strong>HDevelop</strong> is, that it<br />

returns À ÅË ÁÄ if the mouse is outside of the window to indicate that the mouse coordinates<br />

are invalid. This would lead to an interruption of the program. Therefore an explicit error<br />

handling is needed. The complete program is given below:<br />

ÖÑ ´ÁѸ ³ÑÖÙسµ<br />

ÚÐÓ×ÛÒÓÛ ´µ<br />

ÚÓÔÒÛÒÓÛ ´¼¸ ¼¸ ¹½¸ ¹½¸ ³Ð³¸ ÏÒÓÛÁµ<br />

Ú×ÔÐÝ ´Áѵ<br />

ÙØØÓÒ ½<br />

ÛÐ ´ÙØØÓÒ µ<br />

ÚÖÖÓÖÚÖ ´ÖÖÓÖ¸ ½µ<br />

Ú×Ø ´³ÚÖÖÓÖ³µ<br />

ØÑÔÓ×ØÓÒ ´ÏÒÓÛÁ¸ ÊÓÛ¸ ÓÐÙÑÒ¸ ÙØØÓÒµ<br />

ÚÖÖÓÖÚÖ ´ÖÖÓÖ¸ ¼µ<br />

Ú×Ø ´³ÚÖÖÓÖ³µ<br />

´ÖÖÓÖ ÀÅËÌÊ͵<br />

ØÖÝÚÐ ´ÁѸ ÊÓÛ¸ ÓÐÙÑÒ¸ ÖÝÚе<br />

Ú×ØÓÐÓÖ ´³Ð³µ<br />

×ÔÖØÒн ´ÏÒÓÛÁ¸ ¼¸ ¼¸ ¾¾¸ µ<br />

Ú×ØÓÐÓÖ ´³Ûسµ<br />

×ØØÔÓ×ØÓÒ ´ÏÒÓÛÁ¸ ½¸ ¾µ<br />

ÛÖØ×ØÖÒ ´ÏÒÓÛÁ¸ ³´³·ÊÓÛ·³¸³·ÓÐÙÑÒ·³µ³·ÖÝÚе<br />

Ò<br />

ÒÛÐ<br />

After loading an image and opening a window we enter the loop to query the mouse position.<br />

Because the operator Ø ÑÔÓ×ØÓÒ might cause an exception we call Ú ×Ø to<br />

declare that <strong>HDevelop</strong> should not stop if an exception occurs. Ú ×Ø hastobecalled<br />

before and after the critical call(s). If we want to know which error occurred we have to specify<br />

the variable in which the return value will be stored. This is done by using Ú ÖÖÓÖ ÚÖ.<br />

Now Ø ÑÔÓ×ØÓÒ can be called independent of the context. To check if the coordinates<br />

are valid, the error variable is compared to one of the constants for standard return values (like<br />

À ÅË ÌÊÍ or À ÅË ÁÄ). If the call succeeded, this coordinate is used to query the gray<br />

value of the corresponding pixel in the image, which is then displayed in the window.<br />

5.11 Road Scene<br />

File name: ÖÓ ×Ò׺Ú<br />

The computing time is a critical factor in many image analysis tasks. Thus the system has<br />

to offer features to speed up the processing. But direct hardware access must be avoided in<br />

<strong>HDevelop</strong> / 2000-11-16

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!