Skip to content

Instantly share code, notes, and snippets.

View abdul-rehman-2050's full-sized avatar
🎯
Focusing

Abdul Rehman abdul-rehman-2050

🎯
Focusing
View GitHub Profile
@abdul-rehman-2050
abdul-rehman-2050 / pycv_camdisplay_ex01.py
Created April 6, 2016 11:10
simple code to display webcam using python opencv
import cv2
if __name__ == '__main__':
video_capture = cv2.VideoCapture(0)
while True:
# Capture frame-by-frame
ret, frame = video_capture.read()
@abdul-rehman-2050
abdul-rehman-2050 / pycv_camdisplay_ex02.py
Created April 6, 2016 11:16
read webcam and display grayscale image
import cv2
if __name__ == '__main__':
video_capture = cv2.VideoCapture(0)
while True:
# Capture frame-by-frame
ret, frame = video_capture.read()
@abdul-rehman-2050
abdul-rehman-2050 / pycv_matplt_ex01.py
Created April 6, 2016 11:27
matplotlib example to display binary images as a plot
import cv2
from matplotlib import pyplot as plt
cnt=1
if __name__ == '__main__':
video_capture = cv2.VideoCapture(0)
while cnt<5:
# Capture frame-by-frame
ret, frame = video_capture.read()
@abdul-rehman-2050
abdul-rehman-2050 / Contours_pycv_ex01.py
Created April 6, 2016 11:36
display Contours in live webcam video feed
import cv2
if __name__ == '__main__':
video_capture = cv2.VideoCapture(0)
while True:
# Capture frame-by-frame
ret, frame = video_capture.read()
@abdul-rehman-2050
abdul-rehman-2050 / classify.py
Created April 19, 2016 03:28 — forked from yosemitebandit/classify.py
OCR with OpenCV - KNN methods from Abid Rahman
''' classify
after training, classify a sample image with K-Nearest Neighbor
annotated from Abid Rahman's post: http://stackoverflow.com/a/9620295/232638
'''
import cv2
import numpy as np
# load the data we generated previously
samples = np.loadtxt('general-samples.data', np.float32)
import numpy as np
import cv2
import cv
import sys
import os
video_capture = cv2.VideoCapture(0)
SZ=20
@abdul-rehman-2050
abdul-rehman-2050 / MyDBAccess.kt
Created October 23, 2017 11:19
access database from assets\databases\test.db selection queries
package learnkotlin.blogspost.com.sqliteex01
import android.content.Context
import com.readystatesoftware.sqliteasset.SQLiteAssetHelper
/**
* Created by mac on 23/10/2017.....
* Added this line to dependancey
* compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
@abdul-rehman-2050
abdul-rehman-2050 / MainActivity.kt
Created October 23, 2017 11:22
handling listview simplest way wit ItemClickListner
package learnkotlin.blogspost.com.sqliteex01
import android.content.Intent
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.widget.*
import kotlinx.android.synthetic.main.activity_main.*
import android.widget.AdapterView.OnItemClickListener
LayoutInflater factory = LayoutInflater.from(this);
final View deleteDialogView = factory.inflate(R.layout.mylayout, null);
final AlertDialog deleteDialog = new AlertDialog.Builder(this).create();
deleteDialog.setView(deleteDialogView);
deleteDialogView.findViewById(R.id.yes).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
//your business logic
deleteDialog.dismiss();
}
package com.a2050.rehman.abdul.dialogtest
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.support.v7.app.AlertDialog
import android.widget.Toast
import kotlinx.android.synthetic.main.activity_main.*
import android.content.DialogInterface
import android.R.array