omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    SnapSudoku

    Pythonista
    sudoku opencv ocr
    8
    15
    13138
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Phuket2
      Phuket2 @ccc last edited by

      @ccc l did you to and complete the evelator challenge? I was just interested in using it. I live on the 9th floor with 2 elevators. Actually one of the elevators also goes to the roof. So one with 9 floors, the other 10 floors. It's frustratingly bad being at the right place when you need it. Just thought it would be fun to fiddle with a completed simulator

      1 Reply Last reply Reply Quote 0
      • Webmaster4o
        Webmaster4o last edited by

        I remember something similar being in Programming Computer Vision with Python. If I remember correctly, the solution in that book doesn't use OpenCV, but it does use scipy (and maybe also a C implementation of SIFT feature point detection?)

        Anyway, that won't run in Pythonista but it's certainly closer, so I thought I'd share.

        1 Reply Last reply Reply Quote 0
        • wradcliffe
          wradcliffe last edited by

          The use of OpenCV has been one of the most requested features for awhile. Directly integrating a third partly library into Pythonista is a huge amount of work so @omz has had to keep it on the request list in order to concentrate on other priorities such as getting Python3 done.

          A lot has been done with the ability to load and then access a library of code (a framework) from within Pythonista using the objc_util module. You can load and access most of the Apple frameworks now except that you are still limited by Pythonista permissions (plist).

          @omz has stated that he learned some new things that have allowed him to run both Python2 and Python3 as shared libraries of code within the same App. I am hoping that this means that something like OpenCV could also now be tackled as a shared library now. There are others in the forum that have attempted to do this in the past that may know more and weigh in on this. My sense is that it might now be possible to do it for yourself using the current XCode template with the ability to release it to others who own the Pythonista App as a longer term possibility.

          I think your idea for a Sudoku app could make this the "hello world" example of how to do this since it is a game. The UI alone shows how to implement an interactive grid if tiles and has been done many times already in Pythonista. Filling in the grid using OCR would be a killer demo IMHO.

          1 Reply Last reply Reply Quote 1
          • ihf
            ihf last edited by

            I presume you know that Google Goggles does this now. Of course having it in Pythonista running locally would be very nice.

            1 Reply Last reply Reply Quote 0
            • ccc
              ccc last edited by ccc

              I loved Peter Norvig's section on Why?... especially the quote that Sudoku is "a denial of service attack on human intellect"!!

              @Webmaster4o Yes. Section 8.4 Optical Character Recognition starting on pg. 228 of the book you mention above seems to be very applicable but as you say, it requires SciPy which Pythonista does not currently support. Would there be a way to OCR a Sudoku puzzle on the current Pythonista i.e. without OpenCV and SciPy.

              @wradcliffe I am not an expert on this but I do not believe that Apple will allow Pythonista to access a third party shared library. I would love to be proven wrong but I believe the shared library would need to be signed with the same digital signature as Pythonista.

              @ihf I did not know that Google Goggles did this. It is still a cool challenge.

              1 Reply Last reply Reply Quote 0
              • wradcliffe
                wradcliffe last edited by

                @ccc - you may be right but at least we can agree that this is just a decision that Apple can make now as part of the deployment process through the App store. By opening up the discussion again - I was hoping that @omz could share what he has learned recently that may change the picture. I think that @omz has formally sanctioned using PythonistaKit framework outside of the template indicates he is thinking of providing it as its own 3rd party shared library at some point. Maybe soon!

                1 Reply Last reply Reply Quote 0
                • chibill
                  chibill last edited by

                  You could use PIL and a Nueral Network to read the sudoku ad solve it. The problem would be making a nureal network with out using a libaray that uses c code. And also then there is the actual solving.

                  1 Reply Last reply Reply Quote 0
                  • Phuket2
                    Phuket2 last edited by

                    From what I have read the solving is the easy part.,a lot of Python code out there for this. Seems the problematic thing is converting a pic/photo into a sudoku puzzle grid with the entries. That's the challenge

                    1 Reply Last reply Reply Quote 0
                    • Cethric
                      Cethric last edited by

                      Could this library potentially help?
                      I know it is in ObjC however converting it to Python doesn't look to difficult.
                      It would only provide the points, however writing an algorithm to determine where those points are and what they represent shouldn't be too difficult.

                      1 Reply Last reply Reply Quote 0
                      • Webmaster4o
                        Webmaster4o last edited by

                        Note that I've written maze-cv, an app that scans and solves mazes.

                        The code for recognizing box-shaped objects is probably applicable to the soduku application (though maze-cv requires big red markers on the corners)

                        maze-cv includes code for perspective transformations using PIL and numpy that works in Pyyhonista. It also has code for thresholding and segmenting the resulting image. So it really implements everything besides the OCR on individual characters, which I think there are objective c libraries for rendering.

                        Anyway, that's probably useful code, especially since it was all written for Pythonista.

                        1 Reply Last reply Reply Quote 2
                        • ccc
                          ccc last edited by ccc

                          SnapSudoku now uses the Norvig code to solve the Sudoku puzzle. Now we need a version that works on Pythonista. @Webmaster4o can you work your magic like you did with maze-cv or @omz can we get OpenCV or SciPy in Pythonista?

                          1 Reply Last reply Reply Quote 1
                          • chibill
                            chibill last edited by

                            I am working on a simple Nuertal Network for reading numbers to help with this project. If you can break the image into the boxes I can read the number in each one.

                            1 Reply Last reply Reply Quote 1
                            • JonB
                              JonB last edited by

                              http://sudokugrab.blogspot.com/2009/07/how-does-it-all-work.html
                              has a good summary of puzzle detection algorothms, and some refernces on number recognition.

                              1 Reply Last reply Reply Quote 2
                              • Webmaster4o
                                Webmaster4o last edited by

                                Looks like some of the stuff in PCV will run with just matplotlib and numpy, not sure how much though.

                                1 Reply Last reply Reply Quote 1
                                • First post
                                  Last post
                                Powered by NodeBB Forums | Contributors