Touptek Cameras on Unix

Hi to all.

I am trying to use microscopy camera from
Hangzhou ToupTek Photonics Co., Ltd; http://www.touptek.com/.

On windows they support “CAP_DSHOW” what to use on Mac OS X and Linux?

thx Alex

try specifying nothing for apiPreference. OpenCV will use what is appropriate.

Hi, thx for your response.

I tried:
VideoCapture cap(1);
VideoCapture cap(1, CAP_ANY;

But still the video dstream does not open.
OpenCV version : 3.4.4
Initialize camera…
OpenCV: out device of bound (0-0): 1
OpenCV: camera failed to properly initialize!
Error opening video stream

have you tried opening the device with index 0 instead of 1?

yes id did - but this is the internal webcam from my laptop…

heh, good point. ok so whatever backend OpenCV chose seems to not see those cameras. I interpret (0-0) to mean it only accepts the the number 0 (internal webcam as you say).

I have to ask… are those “touptek” cameras regular “USB Video Class” (UVC) devices? or do they need custom drivers/SDK?

the manufacturer’s site’s downloads section implies that you need to install some drivers (available for windows only) and they talk about their SDK. it is probable that you’ll need to get into their SDK.

it should be simple to take whatever data their SDK outputs, and wrap it in a cv::Mat. the right Mat constructor takes a data pointer, width, height, and a pixel type (8 bit, three channels?)

Hi, thnaks for your response. That’s what is seen in the USB tree:
USB3.0 Camera:
Produkt-ID: 0x1122
Hersteller-ID: 0x0547 (Anchor Chips Inc.)
Version: 0.01
Geschwindigkeit: Bis zu 5 Gbit/s
Hersteller: TP
Standort-ID: 0x14300000 / 10
Verfügbare Stromstärke (mA): 900
Erforderliche Stromstärke (mA): 800
Zusätzlicher Betriebsstrom (mA): 0

Ofcourse I will try to convert from TP image format to cv::Mat also.

Hi,

This is what documentation from the cam vendor says.
Could you give me a hint how to convert this to cv::Matt?

c. Data format: RGB vs RAW

Toupcam supports two data formats: RGB format (default) and RAW format. RAW format could be enabled by assigning TOUPCAM_OPTION_RAW parameter to 1 when calling Toupcam_put_Option function.

  • RGB format: The output of every pixel contains 3 componants which stand for R/G/B value respectively. This output is a processed output from the internal color processing engine.

  • RAW format: In this format, the output is the raw data directly output from the sensor. The RAW format is for the users that want to skip the internal color processing and obtain the raw data for user-specific purpose. With the raw format output enabled, the functions that are related to the internal color processing will not work, such as Toupcam_put_Hue or Toupcam_AwbOnePush function and so on.

you can get both to work. RGB will be simpler. as stated, get the data, construct a cv::Mat (see docs for this constructor) using the data pointer, width, height, and CV_8UC3 flag for pixel format. then, use cvtColor with COLOR_RGB2BGR to permute channels into OpenCV’s preferred BGR order.