# Select an Image Source and Acquire Your Image

The first step in most Cognex Designer workflows is to select an image source.

An image source is either a physical camera or a simulated image in a file or database.

For this tutorial, we will be working with simulated images in a VisionPro database.

## If You Have a Physical Camera Configured To Your System

If you already have a physical camera configured to your system, a Camera Acquire block representing your physical camera appears in your Cognex Designer Task window when you create a project using Predefined Project Types. To work with this tutorial, you need to define a camera block that points to a image database.

If you do not have a physical camera configured to your system, proceed to the next section, "Define Your Image Source." Otherwise continue with the instructions in this section.

1. Select the Camera Acquire block representing your physical camera, right-click, and select Delete.
Note: Keep in mind that you are only deleting the camera block, not the camera itself. You can re-add your physical camera's block to a Task at any time by dragging it from the Toolbox pane in the Cameras section.

2. Create an Image File Device to simulate a camera so you can use the image file database in this tutorial..

   1. in the Explorer pane, select Devices > Cameras.\
   2. Right-click Cameras and select Add > 'Image File' Device. The Parameter Configuration dialog box opens.
   3. In the Name field, type FileCamera2.
   4. Click Accept.
3. Create a Camera Acquire block to represent FileCamera2 in the Task window.
   1. From the Toolbox pane, select Cameras > FileCamera2.
   2. Drag FileCamera2 into the left-side of the Task window, replacing the Camera Acquire block you previously deleted. The new Camera Acquire block is labeled Camera1_Acquire, by default.
   3. Continue to the next section to define your image database to this simulated camera block.

## Define Your Image Source

In this tutorial, we will be inspecting simulated images of Jell-O boxes for malformations in the cover graphic. We will inspect a specific region of the image for these defects, or "blobs", keep a running count of how many blobs we find, then display the results in an HMI that can be deployed to a Web page for easy access by end users.

If you do not have a simulated camera configured (which is common if you have a physical camera defined to your system), follow the instructions in the previous section "If You Have a Physical Camera Configured To Your System" if you haven't already.

If you have your simulated camera defined, point your simulated "camera" to the Jell-O Box Image Database in VisionPro.

1. In the Explorer Pane, select Devices > Cameras > FileCamera2.
2. Right-click FileCamera2 and click Select Image Source. The VisionPro Jell-O Box Image Database should already be selected and the path name displayed in the dialog box field. If it is, click Cancel to dismiss the dialog box. If it is not, follow these steps.
   1. Click Choose File.
   2. Navigate to C:\Program Files\Cognex\VisionPro\Images.
   3. Select JellOBoxes.tif.
   4. Click Open.
   5. Click Accept.

## Acquire Your Image

Before you process the images, Cognex Designer has to run a task in order to acquire it.

1. In the Task window, click Run All. Note the green dots that appear on the blocks Camera1_Acquire, InspectImage, and CalculateResult. This indicates that the instructions defined to these task blocks have run successfully. Note that the task block ImageRecorder does not contain a green dot. This is because ImageRecorder, unlike the other blocks, has not yet been configured. You will configure this block later in the tutorial.
2. Click Project > Run to start your vision application executing in "test" mode, "acquiring" images from the Jell-O Box image database. Because a Web Page has been preconfigured with the Single Camera project type, a Web Browser tab opens, displaying one of the Jell-O box images and associated data. Later in the tutorial, you will customize this Web HMI and host it, running an instance of a Web Server on your computer.
3. Select the tab titled Run Mode. This is the preconfigured client HMI. It is similar to the Web HMI, but designed to run as a local session (not on the Web). Note that the image displayed is the same as in the Web HMI.
4. Exit run mode by clicking Project > Stop.
5. Select the Task tab. Hover your mouse over the top connector protruding from the right-side (the output) of the task block Camera1_Acquire. The same image you saw on the HMIs displays and is labeled Image (vproimage). Cognex Designer passes data between blocks using Tags and links. In this case, the image connector pin passes a VisionPro vproimage object to the InspectImage block using a link.

These details may not mean much now, but they are important concepts that you will revisit as you become proficient with the product. Note that Inspecting the output of the camera acquisition block is an accurate way to determine if the Camera1_Acquire block is doing its "job" and processing your image, as depicted in the graphic below.

6. Click File > Save All to save your project before continuing.

You are now ready to add tool blocks to process the simulated image file database that you "acquired" with FileCamera2, your camera running in simulation mode.