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.
Failed to install openCV
-
I just started using pythonista recently(from Jun.2019), but it is difficult to install OpenCV on iOS, which is natural within this forum. As I do not have the skills to install on my own, OpenCV is likely to give up.
It is very regrettable. -
@suzylw, what were you planning to do with OpenCV, what kind of image manipulation?
-
I wanted to recognize images using template matching (OpenCV matchTemplate, etc).
-
-
Thank you for your reply.
The linked <recognition.py> seems a bit different from what I want to do.
What I want to do, for example, is that multiple cards arranged in a table recognize where and what cards are. -
@suzylw Ok, sorry, only to let you know
-
I heard CoreML for the first time, but I wanted to do machine learning in the future, so it was a very useful information to me. Thank you very much.
But to use CoreML, my current skills are lacking, so I would like to study in the future. -
@suzylw Same for me and a lot of us, I think 🤔
-
@suzylw Hi, if you want to start studying openCV (that is, as I see, a fairly widespread and well-known software, so you will find several examples and explanations) without first studying CoreML that needs some objc_util to run, you can use SageMathCell as a free remote python environment to test some not-pure python libraries that can't be installed locally in Pythonista (to use the remote python engine your device must be online and you have about 2 minutes of continuous cpu calculation, due to some necessary restrictions introduced by the authors). See here to learn how to use Pythonista with the SageMath remote server.
Try to open in your internet browser a new cell, put inside the blank window the following code, as example (or use this freeware app, very useful to perform tests):
!sage -pip install -qq --disable-pip-version-check "--target=opencv-contrib-python-headless" opencv-contrib-python-headless sys.path.append(os.getcwd() + "/opencv-contrib-python-headless") import cv2 as cv import numpy as np import matplotlib.pyplot as plt # Feature set containing (x,y) values of 25 known/training data trainData = np.random.randint(0,100,(25,2)).astype(np.float32) # Labels each one either Red or Blue with numbers 0 and 1 responses = np.random.randint(0,2,(25,1)).astype(np.float32) # Take Red families and plot them red = trainData[responses.ravel()==0] plt.scatter(red[:,0],red[:,1],80,'r','^') # Take Blue families and plot them blue = trainData[responses.ravel()==1] plt.scatter(blue[:,0],blue[:,1],80,'b','s') plt.show() newcomer = np.random.randint(0,100,(1,2)).astype(np.float32) plt.scatter(newcomer[:,0],newcomer[:,1],80,'g','o') knn = cv.ml.KNearest_create() knn.train(trainData, cv.ml.ROW_SAMPLE, responses) ret, results, neighbours ,dist = knn.findNearest(newcomer, 3) print( "result: {}\n".format(results) ) print( "neighbours: {}\n".format(neighbours) ) print( "distance: {}\n".format(dist) ) plt.show()
press Evaluate and wait. You should see the output as described here.
The remote server installs in a temporary folder the opencv-python library (that can't be installed locally in Pythonista, as you know).
This is possible thanks to the work made by opencv-python author, who created a full working version of openCV for python, and by authors of the SageMathCell service.
I wish you good experiments and good learning.
Bye -
Thank you for the information of SageMathCell.
I think it will be a useful environment to try out my own program.
The information that will be helpful in the future is very helpful.