analitics

Pages

Thursday, August 11, 2016

The Python and antivirus Kaspersky antivirus.

The Kaspersky antivirus is very reserved versus python.
Even if the pip will try to install one module also any instance of numpy module has one replay over Kaspersky antivirus.
I try to start python shell and then import numpy after that I close the shell and I run it again. 
Update I try also help() / modules command under shell and more and randmon pyd file are blocked. This is strange because the pyd files are random.
See the result is how Kaspersky and python shell works together:
What do you think about that?


Wednesday, July 6, 2016

OpenCV with cutting video background.

This source code is a try to solve the video cutting background.
import cv2
from cv2 import *
import numpy as np
cap = cv2.VideoCapture("avi_test_001.avi")
while(True):
    ret, img = cap.read()
    mask = np.zeros(img.shape[:2],np.uint8)

    bgdModel = np.zeros((1,65),np.float64)
    fgdModel = np.zeros((1,65),np.float64)

    rect = (50,50,450,290)
    cv2.grabCut(img,mask,rect,bgdModel,fgdModel,5,cv2.GC_INIT_WITH_RECT)

    mask2 = np.where((mask==2)|(mask==0),0,1).astype('uint8')
    img = img*mask2[:,:,np.newaxis]
    cv2.imshow('frame',img)
    if 0xFF & cv2.waitKey(5) == 27:
        break
cap.release()
cv2.destroyAllWindows()