Example Code

NI Smart Camera Sudoku Solver with Web Services

Code and Documents

Attachment

Overview

Hold up a normal sudoku puzzle and watch the camera solve it in seconds!

Description

This application will capture and solve sudoku puzzles using a recursive algorithm written in LabVIEW 2009.  The sudoku puzzle, which is printed on a normal sheet of paper, is photographed by the Smart Camera and solved on the embedded Real-Time controller.  The result can either be displayed on the main.vi front panel, or streamed out with web services.  Most puzzles take no more than a few seconds to solve.

Steps to Implement or Execute Code

Prior to the First Run

  1. FTP the included 'sudoku.abc' file to the root directory on the Smart Camera
  2. Specify the IP address of the Smart Camera in the LabVIEW Project
  3. Print the sudoku puzzles in the attached PowerPoint presentation

Running the Application

  1. Open the LabVIEW Project
  2. Run 'main.vi'.' The code should download to the real-time controller, turn on the light, and begin displaying the live image of the puzzle
  3. Place a puzzle under the smart camera
  4. Make sure the borders of the puzzle are within the view on the front panel
  5. Tune the contrast for a crisp, evenly colored, image
  6. Click 'solve puzzle,' to begin solving the puzzle
  7. When it has completed, the missing numbers should be overlayed on the image

Using Web Services

  1. Right click on the Smart Camera and select 'properties'
  2. Make sure the Web Server is turned on
  3. Build and deploy the web service build specification included in the project
  4. Enter http://ipaddress/sudoku/soln into a browser to see the result

Requirements

Software:

  • LabVIEW 2009 or later
  • LabVIEW Real-Time 2009 or later
  • Compatible version of Vision Development Module (same as LabVIEW version)
  • Compatible version of Vision Acquisition Software (see link)

Hardware:

  • NI Smart Camera

Front Panel

Sudoku Front Panel.png

**This document has been updated to meet the current required format for the NI Code Exchange. For more details visit this discussion thread**


Elijah Kerry
NI Director, Software Community

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors