LeoDJ / P2Pro-Viewer

A viewer and API for the InfiRay P2 Pro thermal camera module
MIT License
171 stars 22 forks source link

What to change for Topdon TC001 camera? #9

Closed Adam-yes closed 1 year ago

Adam-yes commented 1 year ago

Hey LeoDJ, I'm truly amazed by your code, it's truly brilliant!

I'm currently trying to get the Topon TC001 up and running on Windows, and since it has the same data stream, it should work. However, I'm facing two issues: 1) What do I need to specifically modify for the resolution and FPS? 2) If I install the libusbK driver via Zadig, I can no longer run the default Topdon program as it stops functioning.

I noticed that someone was able to accomplish it using a Raspberry Pi (https://github.com/leswright1977/PyThermalCamera), but unfortunately, it doesn't work at all for Windows. Even with the added knowledge of separating the data stream that you provided, I haven't been successful in getting it to run. I know this doesn't have much to do with your code and your camera, but I would greatly appreciate your expert opinion.

Best regards!

LeoDJ commented 1 year ago

Currently, my tool is pretty WIP and not finished yet. It probably would be easier to modify Les' tool to run on Windows (I didn't see any Linux specific things on first glance, only a few behaviors that are different on Windows).

As for the TC001, it has the same USB VID/PID (and general behaviour) as the P2 Pro, so no changes should be needed on the viewer's side.

But you do need to "uninstall" the Topdon driver, if you installed their PC software, so it is recognized as a webcam again. There are multiple ways to accomplish this in the Windows device manager, but my favorite method is as follows.

You can select which driver Windows 10 uses for a device like this:

Here you can switch back and forth between the default webcam driver ("USB Composite Device") and the Topdon PC software driver ("TC001"). A P2 Pro with the default webcam driver will be called "USB Video", if you need to find it again. (I don't know how a TC001 is called without their driver).

For Les' tool and the base function of my tool (no commands like "high temperature range", once it's done), only the default Windows webcam driver is needed.

What I wrote in the readme only applies if you want to send those vendor commands.

LeoDJ commented 1 year ago

This pull request should now work on Windows: https://github.com/leswright1977/PyThermalCamera/pull/4

vincpad commented 1 year ago

Hello !

TC001 owner here, I just tried to apply your modifications but python throws me this error after printing the desktop shortcuts

Traceback (most recent call last): File "C:\Users\user\Desktop\PyThermalCamera\src\tc001v4.2.py", line 108, in <module> frame = np.reshape(frame[0], (192*2, 256, 2)) # if there's a "can't reshape size xxxx into shape ..." error here, you most likely used the wrong --device ID File "<__array_function__ internals>", line 200, in reshape File "C:\Python310\lib\site-packages\numpy\core\fromnumeric.py", line 298, in reshape return _wrapfunc(a, 'reshape', newshape, order=order) File "C:\Python310\lib\site-packages\numpy\core\fromnumeric.py", line 57, in _wrapfunc return bound(*args, **kwds) ValueError: cannot reshape array of size 614400 into shape (384,256,2)

It may be caused by the difference of resolution between the two cameras. Also, for info, the TC001 is called "USB Camera" when using the default driver on Windows ;)

Best regards !

EDIT : Nevermind, it was caused by the choice of device, for info for people that could encounter the same issue : call the script with --device <id> on Windows, ID being an int, for me 0 was the integrated camera and 1 was the TC001.