ArduCAM / ArduCAM_USB_Camera_Shield

This is the repository for ArduCAM USB Camera Shield
126 stars 69 forks source link

MT9V022 in NIR or IR range #73

Closed ghost closed 5 years ago

ghost commented 5 years ago

I am trying to find the proper lens configuration to use MT9V022 in IR range. Have removed the IR cut. Have applied a pass-through filter from ebay...the resulting frame is still flooded with daylight. Using the MT9V022 is otherwise good but need NIR or IR specificity, and its not happening.

ArduCAM commented 5 years ago

Can you show me some picture for your problem, so I can see what happened.

ghost commented 5 years ago

The following 2 photo sets are Logitech camera compared to arducam MT9V022 for example only using the colored glass filter 👍 12mm Filter Lens against 400-750nm / Pass 808-1064nm IR Laser Module filter link logitech + filter NICE ISOLATION ir logitech logitech, no filter logitech no filter arducam+filter -NIR filter (glass chip removed) POOR ISOLATION, why? filter arducam - ir cut Arducam no filter no ir cutr arducam no filter no nir cut As you can see I cannot get the MT9V022 to isolate in IR.

ghost commented 5 years ago

Here is another example. LEDs are IR Logitech, nice isolation ir led and logitech

Arducam MT9V022 not adequately filtered. ir led and arducam

Is the colored glass a problem in the filter? How do I filter then using monochrome camera? Don't want to change; the global shutter is awesome.

ghost commented 5 years ago

Should the NIR Cut filter be put back in the Arducam MT9V022? The logitech cam is color.

frascuelillo commented 5 years ago

Did you tried to reduce exposure?, the lights you marked red seems to be a ghost reflected image by the objetive or filter optics surface.

ghost commented 5 years ago

No I haven't tried. It guess it could be due to blooming effect? How do I change the exposure time?

I'm sorry, I need to rephrase: what register do I change in the MTV9022 example? I'm writing in C++, visual studio. The capability might be in the source code already provided?

frascuelillo commented 5 years ago

Sorry, I´m working with AR0134 sensor, don´t know what are the correct register for MTV9022, maybe you could try with the sensor documentation: https://www.onsemi.com/pub/Collateral/MT9V022-D.PDF

ghost commented 5 years ago

Hi Lee, could use some help here:

  1. is the problem over-exposure
  2. how to change exposure time in the MT9V022
ghost commented 5 years ago

Hi Lee, this might make your end easier. The c++ Visual Studio project you guys provided is working out pretty well. It also contains the settings file ArduCamCfg.json. Maybe the exposure time can be altered in this file easily?

ArduCAM commented 5 years ago

The 0xAF bit[1:0] is used to control if you enable the AEC/AGC, you can try to enable these bits to see if it helps to prevent the over exposure issue. Another way is to diasble the AEC/AGC and control the exposure by the 0x0B Coarse Shutter width.

ghost commented 5 years ago

Another way is to diasble the AEC/AGC and control the exposure by the 0x0B Coarse Shutter width.

Ok, setting 0xAF bit = 1, and using the filter sets up the ir isolation nicely, except still getting blooming.

Lets try control by 0x0B Coarse Shutter width:

First I disable the AEC/AGC back to 0xAF,0? Second, I set the Coarse Shutter width register 11 (decimal) or 0x0B(hex) and write a value i.e. 3, 32, or 64? Which value?

ghost commented 5 years ago

I think I have a handle on this. To set the exposure time manually the Automatic Exposure Control or AEC has to be disabled (AEC->R0xAF[0], 0) which then defaults to the value stored in R0x0B for exposure time.

Ok, I get it but I need your help in understanding the number I need for R0x0B (aka register 11). Can you give me a more personalized way of calculating this than the .pdf? Maybe a range of test values?

AGC(automatic gain control). Does this have to be disabled or enabled when the camera is in manual mode for AEC reading values from Registry R0x0B?

Is there a command to reset the camera to default values, or does that automatically occur when you power off?

Thank you Lee

ghost commented 5 years ago

I was using 0xAF incorrectly. The PDF datasheet stated that to identify Automatic Exposure Control use 0xAF[0], value1 and for Automatic Gain Control use 0xAF[1], value 1. If the value for the AEC(0xAF) is 0 it gets the exposure value from register 11. To use manual exposure register 11, AEC (0xAF) must be disabled (0x0). You may want to let the user know this and save the frustration. The datasheet says you identify AEC register this way: 0xAF[0] and AGC this way: 0xAF[1]but only this way seems to work in the Arducam app: 0xAF.

the MTV9022 is filtering IR well even without a filter.

Final requests for this problem set: 1.Can you please give me an example snippet c++ to set register and value? 2.Can you please tell me how to pass [ ] when using AEC/AGC to tell exposure from gain. Datasheet says automatic exposure control address = R0xAF[0], set value & automatic gain address = R0xAF[1], set value. Arducam doesn't recognize brackets []

  1. How to reset camera values to default.

That's pretty easy : )

Success! Below is MT9V022 IR, no filter

mt9v022_ir

ghost commented 5 years ago

Hi Lee, I haven't heard from you in a while. Can you just tell me how to adjust 0xAF and register 11 from within the c++ code. I only have this as a guide (below). Do I need to add a property or use an existing one?

typedef struct
{ Uint32 u32CameraType; // Camera Type Uint16 u16Vid; // Vendor ID for USB

Uint32          u32Width;               // Image Width
Uint32          u32Height;              // Image Height

Uint32          u32Size;

Uint8           u8PixelBytes;
Uint8           u8PixelBits;

format_mode     emImageFmtMode;         // image format mode 

i2c_mode        emI2cMode;
Uint32          u32I2cAddr;

Uint32          u32TransLvl;

}ArduCamCfg;

ghost commented 5 years ago

Not as complicated 👍

use ArduCam_writeSensorReg(handle, reg address, value) (see .h) in main before the thread of course