Comments (16)
Can you explain in more detail what "unclear image" means?
from ic-imaging-control-samples.
Looks like the camera settings changed. I have adjusted the settings in IC capture software for better vision and on running the python script I get a proper image for the first time but for the second time, I a getting an image that looks likes the image settings has changed. If I open and close the software I am getting the proper image.
from ic-imaging-control-samples.
You should implement proper settings management in your program instead of hoping that the device will keep its state between executions.
The simplest was to do that:
- Call ShowPropertyDialog. This will display the same dialog that you use in IC Capture to configure device settings
- Call SaveDeviceStateToFile( ). This Will save the current camera settings into a file
- On startup, call LoadDeviceStateFromFile( ). This will open the previously opened device and restore all camera settings
from ic-imaging-control-samples.
I tried without ShowPropertyDialog() and it's doesn't made a difference. When I tried with ShowPropertyDialog I am getting the error "exception: access violation reading 0x0000000000000001" from tisgrabber.py" after giving "ok" in dialog window.
NB = Mine is a dark environment with a display
from ic-imaging-control-samples.
Hello
Please let us know, which camera model you use.
The access violation is unexpected. Where in your code did you use that? I suppose, it is after Camera.open() call, which is, of course, necessary
Stefan
from ic-imaging-control-samples.
Model No: DFK Z12GP031
I called it after Camera.open().
I tried to save settings without ShowPropertyDialog() and loaded in the next run. It's doesn't made a difference.
from ic-imaging-control-samples.
Hello
Please use the sequence below:
Camera.open("DFK yyyy xxxxx")
Camera.SetContinuousMode(1)
Camera.StartLive(0)
Camera.SnapImage()
Camera.SaveImage(Filename,"JPEG")`
Camera.StopLive()
If the access violation still occurs, please let me know, in which exact line of code it happens.
Thank you in advance!
Stefan
from ic-imaging-control-samples.
Hello,
I have the same access violation issue. The following works fine (no property dialog);
cam.open("DFK yyyy xxxxx")
cam.SetContinuousMode(1)
cam.StartLive(0)
time.sleep(1.0)
cam.SnapImage()
cam.StopLive()
cam.SaveImage(Filename, "JPEG")
However, adding ShowPropertyDialog() results in the access violation;
cam.open("DFK yyyy xxxxx")
cam.ShowPropertyDialog()
cam.SetContinuousMode(1)
cam.StartLive(0)
time.sleep(1.0)
cam.SnapImage()
cam.StopLive()
cam.SaveImage(Filename, "JPEG")
"...\tisgrabber.py", line 470, in SetContinuousMode
return TIS_GrabberDLL.SetContinuousMode(self._handle, Mode)
OSError: exception: access violation reading 0x0000000000000001
Note, if you instead access the property dialog from ShowDeviceSelectionDialog it works fine;
cam = tisgrabber.TIS_CAM()
cam.open("DFK yyyy xxxxx")
# cam.ShowPropertyDialog()
cam.ShowDeviceSelectionDialog() # Clicking properties button in this dlg works fine
cam.SetContinuousMode(1)
cam.StartLive(0)
time.sleep(1.0)
cam.SnapImage()
cam.StopLive()
cam.SaveImage(Filename, "JPEG")
I can provide more info if you need it.
Thank you,
-Robert
from ic-imaging-control-samples.
Hello
Can you please add a source code file, so I can try to debug this on next Monday (it is 5:50 pm now, so I wont start this today, Sorry.)
Stefan
from ic-imaging-control-samples.
Sure, please see attached zip containing minimal_example.py
Thank you!
from ic-imaging-control-samples.
Hello, I think I have a fix; looking at tisgrabber.h "IC_ShowPropertyDialog", it appears the return type is int (success, error, etc.), not hgrabber handle. Updating tisgrabber.py as follows makes it work;
Modify Dll interface like this;
ShowPropertyDialog = __tisgrabber.IC_ShowPropertyDialog
# ShowPropertyDialog.restype = GrabberHandlePtr
ShowPropertyDialog.restype = C.c_int
ShowPropertyDialog.argtypes = (GrabberHandlePtr,)
Modify associated method like this;
def ShowPropertyDialog(self):
# self._handle = TIS_GrabberDLL.ShowPropertyDialog(self._handle)
return TIS_GrabberDLL.ShowPropertyDialog(self._handle)
I tested and it is working on my setup. I can do a pull request if it makes more sense.
Thanks,
-Robert
from ic-imaging-control-samples.
from ic-imaging-control-samples.
Hello Robert.
You are absolutely correct about the the showPropertydialog call in tisgrabber.py. This is a obvious, stupid copy&paste error. I am very sorry.
However, can you help me regarding what I wrote above about using the ImageFileTypes array?
Thank you in advance!
Stefan
from ic-imaging-control-samples.
As you mention, the 's' method is there for compatibility. In Python 2, strings are already bytes and can be used as-is with ctypes 'c_char_p', whereas in Python 3 strings need to be encoded as a byte string to work, hence the 'strin.encode("utf-8")' line in 's'. So the 's' method is important and used a lot for interfacing with tisgrabber.dll.
In the specific case of the 'ImageFileTypes' dict lookup in 'SaveImage'; as you already said, in Python 3 the key will end up being a byte string after going through the 's' method, and it won't work because the dict is expecting a regular string. In Python 2.7 since the 's' method will not modify the key, then the dict lookup will work. I don't have Python 2.7 installed so I can't test this, but I assume that's why SaveImage was working when this was first implemented/tested. So in summary my opinion is removing the 's' from the 'ImageFileTypes' lookup is the smallest/cleanest solution, with the least impact, that works with both Python 2.7 and 3.x.
I hope this helps answer your question. Also I don't use SaveImage in my specific application, I was just using it as part of the minimal example, so it's not urgent for me at least.
Thanks,
-Robert
from ic-imaging-control-samples.
Hi Robert
thank you for your explanation and the recommendation. I will update the tisgrabber.py as soon as possible.
Stefan
from ic-imaging-control-samples.
I solved the issue. Later I found that WDR setting is causing the un-stability of the images. When I tried to calibrate the image without WDR, I am getting stable image.
Thank you for the time 👍
from ic-imaging-control-samples.
Related Issues (20)
- Try to reach the framerate limit of camera HOT 9
- Implementing hardware trigger code using "bursts" HOT 12
- Implement IEEE 1588 PTP HOT 14
- DFK37BUX287:WDR function through tisgrabber.py HOT 9
- Confusion about version of tisgrabber.dll HOT 3
- Framesnapsink/Framequesink HOT 3
- Noise Reduction HOT 18
- Taking images after external trigger for a fixed time HOT 13
- How to operate multiple cameras at the same time get image through python HOT 2
- Knowing when callback fails HOT 8
- Detailed trigger mode setting HOT 2
- Capture AVI program is not working HOT 12
- Activate/deactivate external trigger using python script HOT 4
- Exception: A set operation on a VCDProperty object failed HOT 10
- IC_StartLive fail HOT 3
- Cannot get Map Strings for Strobe Mode in python HOT 18
- Get crashed on create MediaStreamSink object in C# in .net core 7 HOT 2
- Web browser stream HOT 5
- Getting the exposure time HOT 3
- IC Imaging source upgrade to 3.5 from 3.4 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ic-imaging-control-samples.