Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Rotaion python script and changes done in view.py #18

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CamScanner/addRotation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import cv2
import numpy as np

def addRotation(image,degree):
(h,w)=image.shape[:2]
(cx,cy)=(w//2,h//2)

matrix=cv2.getRotationMatrix2D((cx,cy),degree,1.0)
required=cv2.warpAffine(image,matrix,(w,h))
return required
4 changes: 4 additions & 0 deletions CamScanner/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import base64
from . import Applying_perspective
from . import Per_blur
from . import addRotation
from . import convert
import mimetypes

Expand Down Expand Up @@ -111,7 +112,10 @@ def display_last(request):
global points
global done
global refpoints
global degree
done=Per_blur.per_blur(frame,points,refpoints)
done=addRotation.addRotation(frame,degree)

ret, frame_buff = cv2.imencode('.png', done) #could be png, update html as well
frame_b64 = base64.b64encode(frame_buff)

Expand Down