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

Adding in Object Tracking #11

Merged
merged 31 commits into from
Mar 17, 2021
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
switch to bmp
  • Loading branch information
luke-iqt committed Mar 6, 2021
commit c193f62e06a3ca10161fa1600127a4e84402cfa7
52 changes: 51 additions & 1 deletion axis-ptz/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,55 @@ def get_jpeg_request(): # 5.2.4.1
text += str(resp.text)
return text

def get_bmp_request(): # 5.2.4.1
"""
The requests specified in the JPEG/MJPG section are supported by those video products
that use JPEG and MJPG encoding.
Args:
resolution: Resolution of the returned image. Check the product’s Release notes.
camera: Selects the source camera or the quad stream.
square_pixel: Enable/disable square pixel correction. Applies only to video encoders.
compression: Adjusts the compression level of the image.
clock: Shows/hides the time stamp. (0 = hide, 1 = show)
date: Shows/hides the date. (0 = hide, 1 = show)
text: Shows/hides the text. (0 = hide, 1 = show)
text_string: The text shown in the image, the string must be URL encoded.
text_color: The color of the text shown in the image. (black, white)
text_background_color: The color of the text background shown in the image.
(black, white, transparent, semitransparent)
rotation: Rotate the image clockwise.
text_position: The position of the string shown in the image. (top, bottom)
overlay_image: Enable/disable overlay image.(0 = disable, 1 = enable)
overlay_position:The x and y coordinates defining the position of the overlay image.
(<int>x<int>)
Returns:
Success ('image save' and save the image in the file folder) or Failure (Error and
description).
"""
payload = {
'resolution': "1920x1080",
'camera': 1,
}
url = 'https://' + args.axis_ip + '/axis-cgi/bitmap/image.bmp'
resp = requests.get(url, auth=HTTPDigestAuth(args.axis_username, args.axis_password),
params=payload)

if resp.status_code == 200:
captureDir = "capture/{}".format(currentPlane["type"])
try:
os.makedirs(captureDir)
except OSError as e:
if e.errno != errno.EEXIST:
raise # This was not a "directory exist" error..
filename = "{}/{}_{}.bmp".format(captureDir, currentPlane["icao24"],datetime.now().strftime('%Y-%m-%d-%H-%M-%S'))

with open(filename, 'wb') as var:
var.write(resp.content)
return str('Image saved')

text = str(resp)
text += str(resp.text)
return text

def moveCamera():
global actualPan
Expand All @@ -167,7 +216,8 @@ def moveCamera():
lockedOn = True
camera.absolute_move(pan, tilt, cameraZoom, cameraMoveSpeed)
time.sleep(cameraDelay)
get_jpeg_request()
#get_jpeg_request()
get_bmp_request()
else:
if actualX != follow_x or actualY != follow_y:
actualX = follow_x
Expand Down