SPIKE 樂高機器人

我的網頁

2009-09-19

NXTCam colormaps

在NXT上使用NXTCam辨識追蹤物體應該是一件很有趣的事。

不過在使用上並沒有想像中來得容易,

有人提問NXTCam的Colormap資料為何?由於說明書上並沒有說清楚,所以只能用猜測的。

(例如:可能是RGB的上下限值)

mindsensors forum,Deepak Patil先生回答了這個問題,才知道我的推測錯誤。

(是採用遮罩處理方式)

如果有人正在尋找NXTCam的Colormap資料,相信會有很大的幫助!

轉貼如下:(資料來源:mindsensors forum

The colormap is a 48 byte buffer.
From this buffer each of RGB color is assigned 16 bytes for that color.
i.e. first 16 bytes are for Red, next 16 for green and remaining 16 for blue.

These 16 bytes store matching preference for that color's absolute value ranges as
0-16-32-48-64-80-96-112-128-144-160-176-192-208-224-240-255
i.e. first byte is set for color range 0 to 16, second byte for range 16 to 32 and so on...
each bit in the byte contains mask for each object (i.e. 8 objects) which is set to 1 if you want matching object.

example -
if you want 1st object to match red color in range of 16 to 48, you will set first bit to 1 in byte 1 and byte 2.
or if you want 4th object to match any shade of red (0 to 255) then you will set 4th bit of all 16 bytes to 1.

We do have NXTCam_PrepareColormap() and NXTCam_WriteColormap() functions in NXC library, which you can probably adapt to your needs.

沒有留言:

張貼留言

探奇歡迎大家留言討論!謝謝分享你的意見。