If cell equals in Excel
=IF(A1="red",true result,false result)
References
https://exceljet.net/formula/if-cell-equals
=IF(A1="red",true result,false result)
References
https://exceljet.net/formula/if-cell-equals
=B6-TRUNC(B6)
References
https://exceljet.net/formula/get-decimal-part-of-a-number
=COUNTIF(D5:D12,">100") // count sales over 100 =COUNTIF(B5:B12,"jim") // count name = "jim" =COUNTIF(C5:C12,"ca") // count state = "ca" =COUNTIF(A1:A10,100) // count cells equal to 100 =COUNTIF(A1:A10,"<"&B1) // count cells less than B1
References
https://exceljet.net/excel-functions/excel-countif-function
MP4 TO MP4 (MEDIUM) ffmpeg -i input.mp4 -b 1000000 output.mp4 M2TS TO MP4 ffmpeg -i input.m2ts -vcodec libx264 -crf 20 -acodec ac3 -vf "yadif" output.mp4 MP4 TO WEBM (HIGH) ffmpeg -i input.mp4 -aq 5 -ac 2 -qmax 25 -threads 2 output.webm MP4 TO WEBM (MEDIUM) ffmpeg -i input.mp4 -aq 5 -ac 2 -qmax 35 -threads 2 output.webm MP4 TO OGV (HIGH) ffmpeg -i input.mp4 -vcodec libtheora -acodec libvorbis -q:v 6 -q:a 5 output.ogv MP4 TO OGV (MEDIUM) ffmpeg -i input.mp4 -vcodec libtheora -acodec libvorbis -q:v 2 -q:a 4 output.ogv
References
https://gist.github.com/vielhuber/cf918eed2b5cc9eaa63f
import cv2 img = cv2.imread("lenna.png") crop_img = img[y:y+h, x:x+w] cv2.imshow("cropped", crop_img) cv2.waitKey(0)
References
https://stackoverflow.com/questions/15589517/how-to-crop-an-image-in-opencv-using-python
Page segmentation modes:
0 Orientation and script detection (OSD) only.
1 Automatic page segmentation with OSD.
2 Automatic page segmentation, but no OSD, or OCR.
3 Fully automatic page segmentation, but no OSD. (Default)
4 Assume a single column of text of variable sizes.
5 Assume a single uniform block of vertically aligned text.
6 Assume a single uniform block of text.
7 Treat the image as a single text line.
8 Treat the image as a single word.
9 Treat the image as a single word in a circle.
10 Treat the image as a single character.
11 Sparse text. Find as much text as possible in no particular order.
12 Sparse text with OSD.
13 Raw line. Treat the image as a single text line,
bypassing hacks that are Tesseract-specific.
References
https://stackoverflow.com/questions/44619077/pytesseract-ocr-multiple-config-options
import cv2 import pytesseract pytesseract.pytesseract.tesseract_cmd = r"C:\Program Files\Tesseract-OCR\tesseract.exe" image = cv2.imread('2.jpg',0) thresh = cv2.threshold(image, 150, 255, cv2.THRESH_BINARY_INV)[1] result = cv2.GaussianBlur(thresh, (5,5), 0) result = 255 - result data = pytesseract.image_to_string(result, lang='eng',config='--psm 6') print(data) cv2.imshow('thresh', thresh) cv2.imshow('result', result) cv2.waitKey()
We use the --psm 6
config flag since we want to treat the image as a single uniform block of text.
References
https://stackoverflow.com/questions/57719983/pytesseract-not-working-sometimes-on-perfectly-clear-images
https://stackoverflow.com/questions/44619077/pytesseract-ocr-multiple-config-options
ISNUMBER(SEARCH(substring,text))
ISNUMBER(SEARCH(C5,B5))
Case sensitive version
ISNUMBER(FIND(substring,text))
If cell contains
IF(ISNUMBER(SEARCH(substring,text)), "Yes", "No")
With hardcoded search string
ISNUMBER(SEARCH("apple",A1))
References
https://exceljet.net/formula/cell-contains-specific-text
First download tesseract and install it
https://github.com/UB-Mannheim/tesseract/wiki
pip install pytesseract
References
https://pypi.org/project/pytesseract/
https://github.com/UB-Mannheim/tesseract/wiki
from PIL import Image import pytesseract im = Image.open("sample1.jpg") text = pytesseract.image_to_string(im, lang = 'eng') print(text)
Or
import pytesseract import cv2 pytesseract.pytesseract.tesseract_cmd = 'C:\\Program Files (x86)\\Tesseract-OCR\\tesseract.exe' image = cv2.imread("ocr.png") image_grayscal = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) data = pytesseract.image_to_string(image_grayscal)
Read texts in white color
import pytesseract import cv2 pytesseract.pytesseract.tesseract_cmd = 'C:\\Program Files (x86)\\Tesseract-OCR\\tesseract.exe' image = cv2.imread("ocr.png") image_grayscal = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) inverted_image = cv2.bitwise_not(image_grayscal) # color of text is white so we should invert colors data = pytesseract.image_to_string(inverted_image)
References
https://stackoverflow.com/questions/50951955/pytesseract-tesseractnotfound-error-tesseract-is-not-installed-or-its-not-i
https://pupli.net/2020/05/inverting-colors-of-image-in-python-with-opencv/