Informations about Cognex cameras

We have a big project coming up involving a several Cognex cameras (I don’t know yet which ones, but I believe that In-Sight 7000 Models will be used). And we have never before used vision cameras…
As far I was able to find on the internet, Cognex cameras are able to save an image on every trigger to FTP server, from where you can display them in Ignition. So far so good… :slight_smile:
What I’m wondering is: are this images just clean images from a camera or they ‘contain’ also the overlays graphics which can be set in the Cognex software (for ex. name, red circle for fail or something similar…)?
Somewhere I found the info, that overlays are saved as separate .SVG files. Is this true?
If so, how can then I ‘combine’ this two images together and show them in Igniton to the operator?
We will have 7-8 cameras on the assembly line and images will be coming from every camera every few seconds.

If found a few posts here on the forum talking about Cognex, so there must people here, who have experience with this cameras.
Any help/info would be greatly appreciated. :relaxed:

Vision possibilities are very expansive. The 7000 series are an all in one system, so there should be a lot of options for programming. Usually you will be able to save the image with or without overlay. Is the vision application high-speed or high-resolution? If so, be careful, saving the images can increase the processing time.

If you don’t need to display the actual image and only the result there are lots of connectivity options for connecting Ignition directly to the camera… http://www.cognex.com/vision-systems.aspx

EDIT: I misread the word expansive … :grin:
I know about the price of the Cognex. But that’s customer request.
The Cognex cameras will be connected over PROFINET to the Siemens PLC. The PLC will get all the results and I can get from PLC what I need to show on the screen.
As far I can see you can’t get images over the network, only on FTP.
I don’t know yet if high-speed or high-resolution is more important… I suspect something in the middle.
I will need to display the images on the monitor because every workstation with the camera will be inside enclosed frame so the operator would not see inside. But he can see what’s going on on the monitor.
In case that something is wrong (the piece has not pass the inspection) the workstation will stop and then the operator can open the door and go inside.
Then at the end of the assembly line where the product is finished, the customer wants to have an archive of images for every product together with other data for potential warranty claims.
For now (in the process of gathering information for the project) I’m only worried about how I can get the images to show on the Ignition client with custom overlays.

OK, I got the Cognex In-Sight 7050 camera for testing.
I setup FTP server with FileZilla and I’ve got pictures from the camera to the folder on the PC.
Every time you trigger the camera, you get the BMP or JPG file. If you want the overlays, then you get also the SVG file.
This is JPG only file:


And this is combined in Internet Explorer:

I can’t upload the SVG file (forum doesn’t allow), but this is the text from SVG:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="800" height="600" viewBox="0 0 800 600">
<image x="0.0" y="0.0" width="800px" height="600px" xlink:href="Image369.jpg"/>
<line x1="0.0" y1="0.0" x2="800.0" y2="0.0" stroke-width="5" stroke="#FF0000" />
<line x1="0.0" y1="0.0" x2="0.0" y2="600.0" stroke-width="5" stroke="#FF0000" />
<line x1="0.0" y1="600.0" x2="800.0" y2="600.0" stroke-width="5" stroke="#FF0000" />
<line x1="800.0" y1="0.0" x2="800.0" y2="600.0" stroke-width="5" stroke="#FF0000" />
<g>
<line x1="514.4" y1="368.8" x2="516.6" y2="348.9" stroke-width="2" stroke="#00FF00" />
<polyline points="0,0 -12,-6 -10,0 -12,6" fill="#00FF00" stroke="#00FF00" transform="translate(514.4 368.8) rotate(96.4)"/>
<line x1="525.4" y1="360.0" x2="505.6" y2="357.7" stroke-width="2" stroke="#00FF00" />
<polyline points="0,0 -12,-6 -10,0 -12,6" fill="#00FF00" stroke="#00FF00" transform="translate(525.4 360.0) rotate(6.4)"/>
</g>
<polyline points="0,0 -12,-6 -10,0 -12,6" fill="#00FF00" stroke="#00FF00" transform="translate(40.0 320.0) rotate(90.0)"/>
<polyline points="0,0 -12,-6 -10,0 -12,6" fill="#00FF00" stroke="#00FF00" transform="translate(420.0 40.0) rotate(0.0)"/>
<text x="20.0" y="329.0" style="font-family:Arial;font-size:12pt;font-style:normal;font-weight:normal;fill:#00FF00">X</text>
<text x="420.0" y="29.0" style="font-family:Arial;font-size:12pt;font-style:normal;font-weight:normal;fill:#00FF00">Y</text>
<path d="M 40.0,40.0 L 800.0,40.0  L 800.0,600.0  L 40.0,600.0 z " stroke-width="2" stroke="#00FF00" fill="none"/>
<line x1="201.3" y1="148.0" x2="201.3" y2="156.0" stroke-width="2" stroke="#00FF00" />
<line x1="201.3" y1="148.0" x2="201.3" y2="156.0" stroke-width="2" stroke="#00FF00" />
<line x1="201.3" y1="160.0" x2="201.3" y2="168.0" stroke-width="2" stroke="#00FF00" />
<line x1="191.3" y1="158.0" x2="199.3" y2="158.0" stroke-width="2" stroke="#00FF00" />
<line x1="203.3" y1="158.0" x2="211.3" y2="158.0" stroke-width="2" stroke="#00FF00" />
<circle  cx="201.3" cy="158.0" r="10.0" stroke-width="2" stroke="#00FF00" fill="none"/>
<line x1="200.5" y1="132.1" x2="202.1" y2="184.0" stroke-width="2" stroke="#00FF00" />
<line x1="525.3" y1="335.7" x2="525.3" y2="343.7" stroke-width="2" stroke="#00FF00" />
<line x1="525.3" y1="335.7" x2="525.3" y2="343.7" stroke-width="2" stroke="#00FF00" />
<line x1="525.3" y1="347.7" x2="525.3" y2="355.7" stroke-width="2" stroke="#00FF00" />
<line x1="515.3" y1="345.7" x2="523.3" y2="345.7" stroke-width="2" stroke="#00FF00" />
<line x1="527.3" y1="345.7" x2="535.3" y2="345.7" stroke-width="2" stroke="#00FF00" />
<circle  cx="525.3" cy="345.7" r="10.0" stroke-width="2" stroke="#00FF00" fill="none"/>
<line x1="464.9" y1="349.7" x2="585.8" y2="341.7" stroke-width="2" stroke="#00FF00" />
<text x="201.3" y="147.0" style="font-family:Arial;font-size:9pt;font-style:normal;font-weight:normal;fill:#FF0000">Distance_1</text>
<line x1="201.3" y1="158.0" x2="525.3" y2="345.7" stroke-width="2" stroke="#FF0000" />
<polyline points="0,0 -12,-6 -10,0 -12,6" fill="#FF0000" stroke="#FF0000" transform="translate(525.3 345.7) rotate(30.1)"/>
<polyline points="0,0 -12,-6 -10,0 -12,6" fill="#FF0000" stroke="#FF0000" transform="translate(201.3 158.0) rotate(-149.9)"/>
<text x="10.0" y="19.0" style="font-family:Arial;font-size:9pt;font-style:normal;font-weight:normal;fill:#00FF00">Math_1 = 0.000</text>
<text x="300.0" y="209.0" style="font-family:Arial;font-size:9pt;font-style:normal;font-weight:normal;fill:#008000">374.454</text>
</svg>

The second line in SVG shows, that it looks for JPG file and then draws vector graphics over it.
Is it possible now to show this two images (or SVG alone) in Ignition somehow?
I can’t find rhe way…:confused:

Point to the svg file with the web browser component.

1 Like

@jpark
That didn’t cross my mind because web component is not ‘standard’ in Ignition. You must buy it separately…
But yes, I guess I can use that. :+1:
I’ll do more testing. :joy:

The other option would be to parse the svg file and draw the lines / text / shapes and image with the paintable canvas.

Ignition 7.9.5
I have a similar application, but don’t want to purchase the web browser component. Is there an easy way to display bmp or jpg images from a local file (C:\images\myImages.jpg) instead of the svg?

New images are loaded into this file folder on my C:\ every few seconds. The user would like to be able to search through that folder for images with filenames that match a certain description. If that search found (for example) 8 images, I need to then display those 8 images on my client. The search criteria varies, and is actually an opportunity for them to search for a specific serial number (which is also the filename).

Any ideas on how I can do this would be greatly appreciated.
Thanks!

Use an image component, setting the image path to file:///c:/image.jpg

Thanks for the input Jordan. I have set the image path as suggested, which did allow me to display one external image. However when I try to iterate through multiple images, the image displays an error. Below is an example of the debug script I have on a button. I was attempting to change the image path from “…001” to “…002” on a button component action performed script.

newPath = "file:///C:\Images\CAM 1\BAD\100026-H_002.jpg" event.source.parent.getComponent('Image').path = newPath

When I get an error, I mean that the image disappears in the window, and the tiny red circle appears instead.

If this can’t be done with the standard image component, will I be able to dynamically change the image path with the Web Browser Module/Component?

The Web Browser Component would be used to view an SVG at a specific URL.

Microsoft screwed up the world when they decided to go with backslashes for directories. Try using forward slashes.

Or doubling the backslashes when in python quoted strings.

Thanks for the help. I was able to make a list of path names for the images that I wanted to toggle through. Then I allow the operator to traverse the list. Below is the code that worked for me. I use 2 custom methods on the root container.

def createPathList(self):

	import os
	import fnmatch
	
	if self.getComponent('ViewFilters').getComponent('List').selectedIndex != -1: #if a row is selected SN list

		selected_SN = self.getComponent('ViewFilters').getComponent('List').getSelectedValue() #operator selects a SN to search for.
		search_str = selected_SN.rstrip() + "*.jpg"

		path_list = []
		for root, dirs, files in os.walk("C:/images"):
			for filename in fnmatch.filter(files, search_str):
				path_list.append([os.path.join(root,filename)])
			
		if path_list: #if the newly created list of paths is not empty
			self.getComponent('Image').componentEnabled = 1
			self.getComponent('Image').path = "file:///" + path_list[0][0] #display the first image in the list
			self.imageIndex = 0
	
			#imagePaths is a custom property on the container that I use to store the list of paths
			self.imagePaths  = system.dataset.toDataSet(['header'],path_list)
		else:
			blankHeader = []
			blankData = []
			self.imagePaths = system.dataset.toDataSet(blankHeader,blankData)
			self.getComponent('Image').componentEnabled = 0

Then I use a second method to traverse the list of paths which is called by toggle buttons.

def nextImage(self,direction):

	#check the size of the pathList
	rowCount =  self.imagePaths.rowCount	
	
	if rowCount != 0:
		if (self.imageIndex + direction < rowCount) and (self.imageIndex + direction > -1):
			newIndex = self.imageIndex + direction
			self.getComponent('Image').path = "file:///" + self.imagePaths.getValueAt(newIndex,0)
			self.imageIndex = self.imageIndex + direction
			
	else:
		print "Empty Dataset"

@brian.kehn @pturmel @JordanCClark sorry to disturb, but will this work for Perspective?

I am facing a project with Cognex cameras and I successfully managed to store every image in an FTP server (running in the same PC than Ignition gateway). I am storing, for each product SN, all the corresponding images taken to that product.

So my path to the images is something like:

"E:\Cameras\SN\PictureName"

Can I access this path using an Image perspective component?

No, Perspective has no direct access to the local client's filesystem. Because web browsers and technology built on them do not permit it (because malware would have a field day with it).

If you have the images sent to your gateway server, then you could use the WebDev module to create a URL pattern that would retrieve them for Perspective clients.

If you had a script running on the gateway that loaded the images into a Database as blobs, you could use my (free) Blob server module to deliver the images to Perspective clients.

{ This post pre-dates Perspective and uses Vision Client scripting throughout. Inapplicable to Perspective. }

thanks @pturmel , and sorry for not noticing!

Considering the second option:

Maybe, instead of uploading all the images into a Database, I could do it on demand. I mean, only when the user wants to check a picture, I will upload that picture as blob to the database, and then read/show the blob. Does this sound ok?

On the other hand, how could I show the overlay graphics in conjunction with the picture itself?

Maybe. You would have to have it in the database by the time you show a page with a URL for it.

You'd probably have to reprocess the SVG with XML tools (java has built-ins) to replace the embedded image URL with the image blob URL, and load it into the DB for the blob server to deliver to a Perspective IFrame.