Legacy Forum: Preserving Nearly 20 Years of Community History - A Time Capsule of Discussions, Memories, and Shared Experiences.

Bioloid Vision Module

Created by Prof. Hamid Moballegh of The Robocup Humanoid Team of Freie Universität Berlin - fumanoids.de
261 postsPage 8 of 181 ... 5, 6, 7, 8, 9, 10, 11 ... 18
261 postsPage 8 of 181 ... 5, 6, 7, 8, 9, 10, 11 ... 18

Post by hamid_m » Mon May 04, 2009 12:42 pm

Post by hamid_m
Mon May 04, 2009 12:42 pm

Hi mpenoushliev, Hi Limor,

HaViMo is set on the ID=100 and it is hardcoded. This means it is not possible to use it together with AXS1 as long as it has also the same ID.

Hamid.

PS: I receive still no notification for new replies.
Hi mpenoushliev, Hi Limor,

HaViMo is set on the ID=100 and it is hardcoded. This means it is not possible to use it together with AXS1 as long as it has also the same ID.

Hamid.

PS: I receive still no notification for new replies.
hamid_m
Savvy Roboteer
Savvy Roboteer
Posts: 133
Joined: Thu May 03, 2007 4:56 pm

Post by mpenoushliev » Tue May 05, 2009 4:40 pm

Post by mpenoushliev
Tue May 05, 2009 4:40 pm

Well then I guess I`ll change the ID of the AXS1. Oh and btw, can I use the module to analyze the luminosity of a certain area? I.e. for a photovore application. Thanks :)
Well then I guess I`ll change the ID of the AXS1. Oh and btw, can I use the module to analyze the luminosity of a certain area? I.e. for a photovore application. Thanks :)
mpenoushliev
Robot Builder
Robot Builder
Posts: 13
Joined: Tue Apr 21, 2009 1:20 pm

Post by hamid_m » Sun May 10, 2009 1:52 pm

Post by hamid_m
Sun May 10, 2009 1:52 pm

unfortunately not, because all the color values are passed through the look up table before doing anything with them.
unfortunately not, because all the color values are passed through the look up table before doing anything with them.
hamid_m
Savvy Roboteer
Savvy Roboteer
Posts: 133
Joined: Thu May 03, 2007 4:56 pm

Ability to snap a picture with Havimo?

Post by Raymond » Fri May 15, 2009 5:24 am

Post by Raymond
Fri May 15, 2009 5:24 am

Hi Hamid,

Can we use the standard CM5/2+ firmware to interact with havimo to capture an image and echo the output of the image to the com port or otherwise? The reasoning is we wish to operate the Robot and use Havimo. Perhaps this is a silly question. I have two Havimo units and now finally have time to play with yoru cool invention.

Thanks for any guidance you can give

Mark
Hi Hamid,

Can we use the standard CM5/2+ firmware to interact with havimo to capture an image and echo the output of the image to the com port or otherwise? The reasoning is we wish to operate the Robot and use Havimo. Perhaps this is a silly question. I have two Havimo units and now finally have time to play with yoru cool invention.

Thanks for any guidance you can give

Mark
Raymond
Savvy Roboteer
Savvy Roboteer
Posts: 80
Joined: Sat Apr 11, 2009 7:17 pm

Raw image to BMP/JPG file

Post by Raymond » Sat May 16, 2009 8:37 pm

Post by Raymond
Sat May 16, 2009 8:37 pm

Hi Hamid or any image guru's,

Can you share any api or file structure info to convert the raw image to either a bmp or jpg file format. I read the camera doc but it assumes a good working knowledge of the terms in video/image structures and doesnt speak to precise formats to take the bytes I need.

I will take baby steps and first create a b&w bmp from raw image if that is easier to explain.

Please help.

Thanks

Mark
Hi Hamid or any image guru's,

Can you share any api or file structure info to convert the raw image to either a bmp or jpg file format. I read the camera doc but it assumes a good working knowledge of the terms in video/image structures and doesnt speak to precise formats to take the bytes I need.

I will take baby steps and first create a b&w bmp from raw image if that is easier to explain.

Please help.

Thanks

Mark
Raymond
Savvy Roboteer
Savvy Roboteer
Posts: 80
Joined: Sat Apr 11, 2009 7:17 pm

formating raw sample correctly To save as a BMP

Post by Raymond » Mon May 18, 2009 10:40 pm

Post by Raymond
Mon May 18, 2009 10:40 pm

Hi Guys,

I wanted to clarify how to interpret the raw sample correctly as per Hamid's response below:

"RAW SAMPLE" is pretty esay. After you send the packet, you recieve 160*120 bytes, each of which contains the Y value of an individual pixel packed in a nibble, and another nibble containing Cr or Cb shared between two neighbor pixels.
I suggest that you try finding the Y value fisrt and form a BW image and then try to use the Cr,Cb values"

My questions are:

1) what bit size are the Y, Cr, Cb values
2) What is the actual resolution being sampled with the raw sample
3) What is a nibble? 4 bits?

Thanks

Mark
Hi Guys,

I wanted to clarify how to interpret the raw sample correctly as per Hamid's response below:

"RAW SAMPLE" is pretty esay. After you send the packet, you recieve 160*120 bytes, each of which contains the Y value of an individual pixel packed in a nibble, and another nibble containing Cr or Cb shared between two neighbor pixels.
I suggest that you try finding the Y value fisrt and form a BW image and then try to use the Cr,Cb values"

My questions are:

1) what bit size are the Y, Cr, Cb values
2) What is the actual resolution being sampled with the raw sample
3) What is a nibble? 4 bits?

Thanks

Mark
Raymond
Savvy Roboteer
Savvy Roboteer
Posts: 80
Joined: Sat Apr 11, 2009 7:17 pm

Raw Sample addiotnal query

Post by Raymond » Mon May 18, 2009 11:24 pm

Post by Raymond
Mon May 18, 2009 11:24 pm

Hi Hamid,

I thought I'd explain further my logic for your correction:

The bytes in the raw sample are they either of the two(2) formats

Option 1

Byte1 = Y, Cb; Byte2 = Y, Cr, Byte3 = Y, Cb .. etc where Y = 4bits,
Cb = 4 bits Cr = 4 bits

Option 2

Byte1 = Y, Cb Cr; Byte2 = Y, Cb Cr, Byte3 = Y, Cb Cr .. etc, where Y = 4bits, Cb = 2bits, Cr = 2bits

Thanks

Mark
Hi Hamid,

I thought I'd explain further my logic for your correction:

The bytes in the raw sample are they either of the two(2) formats

Option 1

Byte1 = Y, Cb; Byte2 = Y, Cr, Byte3 = Y, Cb .. etc where Y = 4bits,
Cb = 4 bits Cr = 4 bits

Option 2

Byte1 = Y, Cb Cr; Byte2 = Y, Cb Cr, Byte3 = Y, Cb Cr .. etc, where Y = 4bits, Cb = 2bits, Cr = 2bits

Thanks

Mark
Raymond
Savvy Roboteer
Savvy Roboteer
Posts: 80
Joined: Sat Apr 11, 2009 7:17 pm

Post by hamid_m » Tue May 19, 2009 10:35 pm

Post by hamid_m
Tue May 19, 2009 10:35 pm

Hi Mark,

Sorry for the late reply, I still receive no notification.

Option1 is the right one, every byte is divided into two nibbles, one of which is the Y value and the other one is Cr/Cb value.

Best regards,
Hamid.
Hi Mark,

Sorry for the late reply, I still receive no notification.

Option1 is the right one, every byte is divided into two nibbles, one of which is the Y value and the other one is Cr/Cb value.

Best regards,
Hamid.
hamid_m
Savvy Roboteer
Savvy Roboteer
Posts: 133
Joined: Thu May 03, 2007 4:56 pm

raw Sample Resolution

Post by Raymond » Wed May 20, 2009 1:58 am

Post by Raymond
Wed May 20, 2009 1:58 am

Hi Hamid,

Thanks for the reply, I know the notification seems not an exact science. Thank you for the response. I believe there i some other minor points I need to confirm and that is as follows:

1) 160 x 120 is for an entire frame or do we have to request several raw samples to get a complete picture

2) Is there an offset to start expecting the Y1Cr1, Y2Cb1, Y3Cr2, Y4Cb....

3) What is the number of bytes per row

Why I ask is I am creating an image that suggests I am not starting at the right pixel for the row and/or col.

This is driving a little crazy and thank you for your patience and help, I really like the product and hope to share my findings with the enthusiasts.

Cheers

Mark
Hi Hamid,

Thanks for the reply, I know the notification seems not an exact science. Thank you for the response. I believe there i some other minor points I need to confirm and that is as follows:

1) 160 x 120 is for an entire frame or do we have to request several raw samples to get a complete picture

2) Is there an offset to start expecting the Y1Cr1, Y2Cb1, Y3Cr2, Y4Cb....

3) What is the number of bytes per row

Why I ask is I am creating an image that suggests I am not starting at the right pixel for the row and/or col.

This is driving a little crazy and thank you for your patience and help, I really like the product and hope to share my findings with the enthusiasts.

Cheers

Mark
Raymond
Savvy Roboteer
Savvy Roboteer
Posts: 80
Joined: Sat Apr 11, 2009 7:17 pm

YCbCr to grey scale interpretation

Post by Raymond » Fri May 22, 2009 1:14 am

Post by Raymond
Fri May 22, 2009 1:14 am

Hi Hamid,

My difficulty it seems is to both map the Y to a grey scale/BW and ensure it is in phase with the resolution. Therefore I ask your help to confirm if my assumptions are correct with the follow examples:

Let's say the first 4 bytes in Hex from Raw Sample are: 78 65 97 A5

What is the value of Y in each byte? is it

1) 70 60 90 A0
Or
2) 78 65 97 A5

Are the values in sequence of rows or by columns, for e.g.:

(row1,col1),(row1,col2),(row1,col3)....
(row2,col1),(row2,col2),(row2,col3)....
Or
(row1,col1),(row2,col1),(row3,col1)....
(row1,col2),(row2,col2),(row3,col2)....

What is the 2 values of Cb in this 4 byte sample are they:

1) Cb1 80, Cb2 70

What is the resolution of the raw sample? Is it 160 x 120?

Beyond this any algorithm you have to share would be most welcomed. I know this is beyond the support required for the device but I would be grateful..

Thanks

Mark
Hi Hamid,

My difficulty it seems is to both map the Y to a grey scale/BW and ensure it is in phase with the resolution. Therefore I ask your help to confirm if my assumptions are correct with the follow examples:

Let's say the first 4 bytes in Hex from Raw Sample are: 78 65 97 A5

What is the value of Y in each byte? is it

1) 70 60 90 A0
Or
2) 78 65 97 A5

Are the values in sequence of rows or by columns, for e.g.:

(row1,col1),(row1,col2),(row1,col3)....
(row2,col1),(row2,col2),(row2,col3)....
Or
(row1,col1),(row2,col1),(row3,col1)....
(row1,col2),(row2,col2),(row3,col2)....

What is the 2 values of Cb in this 4 byte sample are they:

1) Cb1 80, Cb2 70

What is the resolution of the raw sample? Is it 160 x 120?

Beyond this any algorithm you have to share would be most welcomed. I know this is beyond the support required for the device but I would be grateful..

Thanks

Mark
Raymond
Savvy Roboteer
Savvy Roboteer
Posts: 80
Joined: Sat Apr 11, 2009 7:17 pm

Post by hamid_m » Fri May 22, 2009 10:03 am

Post by hamid_m
Fri May 22, 2009 10:03 am

Hi Mark,

I think this part of code can help:

Code: Select all
  cmd:='S';
  ComPort1.Write(cmd,1);
  for k:= 0 to 39 do
  begin
    for j:=0 to 119 do
    begin
      time:= GetTickCount;
      while (comport1.InQue<4) and (GetTickCount-time<1000>=1000) then exit;
      ComPort1.Read(buff[0],4);
      for i:= 0 to 3 do
      begin
        Image[i+k*4,j]:=buff[i];
      end;
    end;
  end;
  for j:=0 to 119 do
  begin
    for i:= 0 to 159 do
    begin
      y:=((Image[i,j]) and 15) shl 4;

      if i and 1 = 1 then cb:=((Image[i,j]) and 240) else cr:=((Image[i,j]) and 240);

      calcR := Y + 1.371 * (Cr - 128);
      calcG := Y - 0.698 * (Cr - 128) - 0.336 * (Cb - 128);
      calcB := Y + 1.732 * (Cb - 128);
      if (calcR < 0) then calcR := 0;
      if (calcG < 0) then calcG := 0;
      if (calcB <0> 255) then calcR := 255;
      if (calcG > 255) then calcG := 255;
      if (calcB > 255) then calcB := 255;
      r := trunc(calcR);
      g := trunc(calcG);
      b := trunc(calcB);
      putpixel(i,j,rgb(r,g,b));

    end;
  end;
  Form2.Visible:=False;



this reads a whole frame from the camera and write it into the 2D array image, then converts the image into RGB and paints it on a canvas.

Hamid.
Hi Mark,

I think this part of code can help:

Code: Select all
  cmd:='S';
  ComPort1.Write(cmd,1);
  for k:= 0 to 39 do
  begin
    for j:=0 to 119 do
    begin
      time:= GetTickCount;
      while (comport1.InQue<4) and (GetTickCount-time<1000>=1000) then exit;
      ComPort1.Read(buff[0],4);
      for i:= 0 to 3 do
      begin
        Image[i+k*4,j]:=buff[i];
      end;
    end;
  end;
  for j:=0 to 119 do
  begin
    for i:= 0 to 159 do
    begin
      y:=((Image[i,j]) and 15) shl 4;

      if i and 1 = 1 then cb:=((Image[i,j]) and 240) else cr:=((Image[i,j]) and 240);

      calcR := Y + 1.371 * (Cr - 128);
      calcG := Y - 0.698 * (Cr - 128) - 0.336 * (Cb - 128);
      calcB := Y + 1.732 * (Cb - 128);
      if (calcR < 0) then calcR := 0;
      if (calcG < 0) then calcG := 0;
      if (calcB <0> 255) then calcR := 255;
      if (calcG > 255) then calcG := 255;
      if (calcB > 255) then calcB := 255;
      r := trunc(calcR);
      g := trunc(calcG);
      b := trunc(calcB);
      putpixel(i,j,rgb(r,g,b));

    end;
  end;
  Form2.Visible:=False;



this reads a whole frame from the camera and write it into the 2D array image, then converts the image into RGB and paints it on a canvas.

Hamid.
hamid_m
Savvy Roboteer
Savvy Roboteer
Posts: 133
Joined: Thu May 03, 2007 4:56 pm

Splendid

Post by Raymond » Fri May 22, 2009 12:13 pm

Post by Raymond
Fri May 22, 2009 12:13 pm

Hi hamid,

This is awesome. The code answers all my questions. It would seem the cameras documentation had the YCbCr values in the wrong msb/lsb placement. I should have used other layouts shown in other cameras, so much for following documentation tot he letter lol. I really apreciate your help, now I can finish this analysis finally!

Cheers!

Mark
Hi hamid,

This is awesome. The code answers all my questions. It would seem the cameras documentation had the YCbCr values in the wrong msb/lsb placement. I should have used other layouts shown in other cameras, so much for following documentation tot he letter lol. I really apreciate your help, now I can finish this analysis finally!

Cheers!

Mark
Raymond
Savvy Roboteer
Savvy Roboteer
Posts: 80
Joined: Sat Apr 11, 2009 7:17 pm

The phase part i would never have figured out!

Post by Raymond » Fri May 22, 2009 1:26 pm

Post by Raymond
Fri May 22, 2009 1:26 pm

Hi hamid,

Thanks a mil! That phase formula I would never in a million years figured out. maybe it's a formula routine for you image guru's :)

Thanks again!

Mark
Hi hamid,

Thanks a mil! That phase formula I would never in a million years figured out. maybe it's a formula routine for you image guru's :)

Thanks again!

Mark
Raymond
Savvy Roboteer
Savvy Roboteer
Posts: 80
Joined: Sat Apr 11, 2009 7:17 pm

Focus and Overexposure colour cheme

Post by Raymond » Sat May 23, 2009 9:38 pm

Post by Raymond
Sat May 23, 2009 9:38 pm

Hi Hamid,

Two more quickie questions:

1) How to focus if possible
2) Any suggestions how to experiment with the YCbCr -> RGB to present images that don't look overexposed

Cheers

Mark
Hi Hamid,

Two more quickie questions:

1) How to focus if possible
2) Any suggestions how to experiment with the YCbCr -> RGB to present images that don't look overexposed

Cheers

Mark
Raymond
Savvy Roboteer
Savvy Roboteer
Posts: 80
Joined: Sat Apr 11, 2009 7:17 pm

RGB conversion thought

Post by Raymond » Sun May 24, 2009 9:20 pm

Post by Raymond
Sun May 24, 2009 9:20 pm

Hi hamid,

It occurred to me that I may be possibly trying to replicate the configuration aspect of the module. If that is the case then may I ask if I use the configuration tool then set the various registers of the camera and then when I do a raw sample the picture will look clean and not like an ;acid trip'. If that is not the case then do I need to be creative with the formula going from YCbCr to -> RGB?

I know I'm doing things the hard way but I'm new to image theory but learning thanks to your help and what docuents that exist online.
Perhaps I need to state that I am saving the data as a 24bit BMP and not sending to the screen buffer directly. So the image is being displayed througha normal viewer by loading the BMP I create. If this makes a difference please enlighten me.

Cheers

Mark
Hi hamid,

It occurred to me that I may be possibly trying to replicate the configuration aspect of the module. If that is the case then may I ask if I use the configuration tool then set the various registers of the camera and then when I do a raw sample the picture will look clean and not like an ;acid trip'. If that is not the case then do I need to be creative with the formula going from YCbCr to -> RGB?

I know I'm doing things the hard way but I'm new to image theory but learning thanks to your help and what docuents that exist online.
Perhaps I need to state that I am saving the data as a 24bit BMP and not sending to the screen buffer directly. So the image is being displayed througha normal viewer by loading the BMP I create. If this makes a difference please enlighten me.

Cheers

Mark
Raymond
Savvy Roboteer
Savvy Roboteer
Posts: 80
Joined: Sat Apr 11, 2009 7:17 pm

PreviousNext
261 postsPage 8 of 181 ... 5, 6, 7, 8, 9, 10, 11 ... 18
261 postsPage 8 of 181 ... 5, 6, 7, 8, 9, 10, 11 ... 18