omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. sodoku

    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.


    • Profile
    • Following 0
    • Followers 0
    • Topics 9
    • Posts 48
    • Best 0
    • Controversial 0
    • Groups 0

    sodoku

    @sodoku

    0
    Reputation
    1112
    Profile views
    48
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    sodoku Unfollow Follow

    Latest posts made by sodoku

    • RE: iOS core ml mnist

      Because it has way too many errors without from the last thread where I got the last Code that can take pictures of text and numbers either from your library or a disposable picture with the camera but I get way too many errors

      posted in Pythonista
      sodoku
      sodoku
    • iOS core ml mnist

      So I just updated to iOS 15.3 and it said it can download core mls for machine learning modules and on their web site they got something called mnist and I need it to take a picture of my sudoku puzzle and input them into my app I’m gonna go check out the old thread on the forum but if anyone of you can build it and compose it faster I just need it to print it properly in the console like a 9 by 9 and I can adapt it to my sudoku app

      posted in Pythonista
      sodoku
      sodoku
    • Is Speech to text possible ?

      Is it possible to make speech to text with pythonista to print to the console,

      Or also displaying it as a textsprite thingy

      posted in Pythonista
      sodoku
      sodoku
    • RE: How do you split/slice list of strings

      Cool awesome Thanks this worked I did not know you could use for twice in one line of code

      a=[‘Haloween’, ‘Boom’, ‘hi’, ‘Howl’, ‘if’, ‘ghosts’]
      B=[s[i:i+2] for s in a for i in range(0, len(s), 2)]
      Print(B)
      
      posted in Pythonista
      sodoku
      sodoku
    • How do you split/slice list of strings

      I have a question about a list of strings

      Say I got a list like

      a=[‘Haloween’, ‘Boom’, ‘hi’, ‘Howl’, ‘if’, ‘ghosts’]
      

      How do you split or slice the strings to make a list like

      a=[‘Ha’, ‘lo’, ‘we’, ‘en’, ‘Bo’, ‘om’, ‘hi’, ‘Ho’, ‘wl’, ‘if’, ‘gh’, ‘os’, ‘ts’]
      

      Is this possible to do?

      posted in Pythonista
      sodoku
      sodoku
    • RE: Stash, PIP and versions

      Question 1
      Are you able to pip install opencv cv2 with stash?

      Question 2
      Are you able to install tessaract and pytessaract with stash?

      Question 3
      Does pythonista 3 come with Core ML already or does it need to be installed?

      posted in Pythonista
      sodoku
      sodoku
    • RE: Recognize text from picture

      I have a quick question in regards to the original ocr post how do I print the text as one single csv list, I tried but I have been getting a list of lists instead of one single list

      This is a snippet of the code example I think needs to be altered

        success = handler.performRequests_error_([req], None)
          if success:
              for result in req.results():
                  print(result.text())
          else:
              print('Problem recognizing anything')
      
      posted in Pythonista
      sodoku
      sodoku
    • RE: Recognize text from picture

      ive seen the apple documentation coding on Vision Framework I just dont know how to convert it to python

      Question 1
      What about the setting the minimum text height how do you translate either of these codes to python????
      @property(readwrite, nonatomic, assign) float minimumTextHeight; written in objective-c
      var minimumTextHeight: Float { get set } written in Swift

      Question 2
      I was also interested in learning how to recognize the individual boxes from a sudoku puzzle to extract the numbers is there a way to do that possibly with
      VNRecognizedTextObservation A request that detects and recognizes regions of text in an image.
      or possibly with the bounding box technique show in the video https://developer.apple.com/videos/play/wwdc2019/234 , also can you put multiple bounding boxes to recognize text from a sudoku card

      this is Mikeals code i am trying to insert the code into but dont know how to convert the code shown in the apple documentation into python

      language_preference = ['fi','en','se']
      
      import photos, ui, dialogs
      import io
      from objc_util import *
      
      load_framework('Vision')
      VNRecognizeTextRequest = ObjCClass('VNRecognizeTextRequest')
      VNImageRequestHandler = ObjCClass('VNImageRequestHandler')
      
      def pil2ui(pil_image):
          buffer = io.BytesIO()
          pil_image.save(buffer, format='PNG')
          return ui.Image.from_data(buffer.getvalue())
      
      selection = dialogs.alert('Get pic', button1='Camera', button2='Photos')
      
      ui_image = None
      
      if selection == 1:
          pil_image = photos.capture_image()
          if pil_image is not None:
              ui_image = pil2ui(pil_image)
      elif selection == 2:
          ui_image = photos.pick_asset().get_ui_image()
      
      if ui_image is not None:
          print('Recognizing...\n')
      
          req = VNRecognizeTextRequest.alloc().init().autorelease()
          req.recognitionLevel=1
          req.setRecognitionLanguages_(language_preference)
          handler = VNImageRequestHandler.alloc().initWithData_options_(ui_image.to_png(), None).autorelease()
      
          success = handler.performRequests_error_([req], None)
          if success:
              for result in req.results():
                  print(result.text())
          else:
              print('Problem recognizing anything')
      
      posted in Pythonista
      sodoku
      sodoku
    • RE: Recognize text from picture

      I have a few questions about the very first text recognition code posted on this one

      the example video I am referring to is https://developer.apple.com/videos/play/wwdc2019/234

      1 how do you change the recognition level from fast to accurate
      example code from apple website I am not sure if its written in swift or objective c but it is like this :

      myTextRegcognitionRequest.recognitionLevel = VNRequestTextRecognitionLevel.accurate
      

      and another example of this shown in the apple video for setting the recognition level

       request.recognitionLevel = .fast 
      

      question 2
      to ensure that numbers don't get mistaken as letters
      without the language corrector active to avoid mistaking the number 5 for an S or I as 1
      example of this from the video is

      extension Character {
             
           func GetSimilarCharacterIfNotIn(allowedChars: String -> Character {
                  let  conversionTable = [
                            's':'5',
                            'S':'5',
                            'i':'1',
                            'I':'1', ] 
      

      question 3
      if you know how to set up the special words detector thingy feature mentioned in the video

      posted in Pythonista
      sodoku
      sodoku
    • RE: Recognize text from picture

      I need help adapting this script for inputting the numbers from a picture of sudoku and insert the starting numbers into a console script, it does not work good for recognizing ones and sevens???

      Example of sudoku solver

      In my version I want to make the board is all zeros and when you take a picture it will add the numbers than solve, this combines the two programs (sudoku solver) & (ocr text recognition)

      board=[
         [5,8,4,1,0,0,0,0,0],
         [0,0,6,8,0,0,5,1,0],
         [0,0,0,0,5,4,7,0,6],
         [0,5,3,0,1,0,0,6,7],
         [0,0,0,0,2,0,0,0,0],
         [4,6,0,0,9,0,8,3,0],
         [7,0,8,5,4,0,0,0,0],
         [0,2,9,0,0,3,4,0,0],
         [0,0,0,0,0,1,3,7,9]
         ]
      
      
      
      def solve(bo):
      
         find = find_empty(bo)
         if not find:
         	return True
         else:
         	row,col = find
      
         for i in range(1,10):
         	if valid(bo,i,(row,col)):
         		bo[row][col] = i
      
         		if solve(bo):
         			return True
      
         		bo[row][col] = 0
      
         return False
      
      
      
      def valid(bo,num,pos):
         #check row
         for i in range(len(bo[0])):
         	if bo[pos[0]][i] == num and pos[1] != i:
         		return False
         #check column
         for i in range(len(bo[0])):
         	if bo[i][pos[1]] == num and pos[0] != i:
         		return False
         #check quadrant
         box_x = pos[1] // 3
         box_y = pos[0] // 3
      
         for i in range(box_y * 3, box_y * 3 + 3):
         	for j in range(box_x * 3, box_x * 3 + 3):
         		if bo[i][j] == num and (i,j) != pos:
         			return False
      
         return True
      
      
      
      def print_board(bo):
         for i in range(len(bo)):
         	if i % 3 == 0 and i != 0:
         		print('------+-------+------')
      
         	for j in range(len(bo[0])):
         		if j % 3 == 0 and j != 0:
         			print('|',end=' ')
         		if j == 8:
         			print(bo[i][j])
         		else:
         			print(str(bo[i][j])+ ' ', end='')
      
      def find_empty(bo):
         for i in range(len(bo)):
         	for j in range(len(bo[0])):
         		if bo[i][j] == 0:
         			return (i,j) # row, col
         return None
      
      
      
      print_board(board)
      solve(board)
      print('=====================')
      print_board(board)
      
      language_preference = ['fi','en','se']
      
      import photos, ui, dialogs
      import io
      from objc_util import *
      
      load_framework('Vision')
      VNRecognizeTextRequest = ObjCClass('VNRecognizeTextRequest')
      VNImageRequestHandler = ObjCClass('VNImageRequestHandler')
      
      def pil2ui(pil_image):
         buffer = io.BytesIO()
         pil_image.save(buffer, format='PNG')
         return ui.Image.from_data(buffer.getvalue())
      
      selection = dialogs.alert('Get pic', button1='Camera', button2='Photos')
      
      ui_image = None
      
      if selection == 1:
         pil_image = photos.capture_image()
         if pil_image is not None:
             ui_image = pil2ui(pil_image)
      elif selection == 2:
         ui_image = photos.pick_asset().get_ui_image()
      
      if ui_image is not None:
         print('Recognizing...\n')
      
         req = VNRecognizeTextRequest.alloc().init().autorelease()
         req.setRecognitionLanguages_(language_preference)
         handler = VNImageRequestHandler.alloc().initWithData_options_(ui_image.to_png(), None).autorelease()
      
         success = handler.performRequests_error_([req], None)
         if success:
             for result in req.results():
                 print(result.text())
         else:
             print('Problem recognizing anything') ```
      posted in Pythonista
      sodoku
      sodoku