Home > Mobile >  Questions about Kivy into image name
Questions about Kivy into image name

Time:05-28

Question: can you tell me the kivy the "source" of the picture can use variable assignment? If you can, how should do?
As shown in figure, when I directly to the source assignment string: source: "HDR/fusion_xxx. PNG" can be normal, according to
But when I use the variable assignment, did not display properly,


All code:
The from kivy. App import app
The from kivy. Uix. Boxlayout import boxlayout
The from kivy. Uix. Screenmanager import screenmanager, Screen
The from kivy. Lang import Builder
The from kivy. Uix. Image import image
The from kivy. Lang import Builder
The from kivy. Uix. Label the import label
The import time
The import kivy
The import cv2 as CV
The import numpy as np
The import argparse
The import OS
The import cv2
The from kivy. Clock import clock
The from kivy. Graphics. Texture import texture
The from kivy. Core. The window the import window
The import pygame. Camera
The import pygame. Image

Builder. Load_string (" ", "
:
BoxLayout:
Orientation: 'vertical'
Camera:
Id: sjnCamera
Play: True
Index: 0
Width: '60 dp'
Height: '80 dp'
# Preview:
# id: qrcam

BoxLayout:
Orientation: 'horizontal'
1
size_hint: 1,.Button:
Text: 'camera0'
1,1,0,1 background_color:
On_press: root selectCamera (0)
Button:
Text: 'camera1'
1,1,0,1 background_color:
On_press: root. SelectCamera (1)
Button:
Text: 'camera2'
1,1,0,1 background_color:
On_press: root selectCamera (2)
Button:
Text: 'camera3'
1,1,0,1 background_color:
On_press: root selectCamera (3)

BoxLayout:
Orientation: 'horizontal'
1
size_hint: 1,.Button:
Text: 'one stop'
1,1,0,1 background_color:
On_press: root. SelectCompensation (1)
Button:
Text: '2 stop'
1,1,0,1 background_color:
On_press: root selectCompensation (2)
Button:
Text: '3 stop'
1,1,0,1 background_color:
On_press: root selectCompensation (3)

BoxLayout:
Orientation: 'horizontal'
Size_hint_y: None
Height: '48 dp'
Button:
Text: 'Display'
='photo_screen on_press: root. The manager. The current'
Button:
Text: 'Shoot'
On_press: root takePicture ()
Button:
Text: 'createCamera'
# on_press: root. CreateCamera ()

:
Display_HDR_image: "/HDR/fusion_175225. PNG"
BoxLayout:
Orientation: 'vertical'

# Image:
# source: root display_HDR_image
# id: HDR_display
9 # size_hint: 1,.

Button:
Id: btn1
9
size_hint: 1,.# dhi: "/HDR/fusion_175225. PNG"
Canvas. After:
A Rectangle:
Id: HDR_display
Pos: self. Pos
Size: the self size
Source: the root display_HDR_image
# source: self. Dhi
# source: "HDR/fusion_175225. PNG"
# Image:
# width: '60 dp'
# height: '80 dp'
# source: root display_HDR_image


# Image:
# id: HDR_display
9 # size_hint: 1,.
# allow_stretch: True
# source: root display_HDR_image

# canvas:
# a Rectangle:
9 # # size_hint: 1,.
# # size: self. Width + 20, the self. The height + 20
# pos: self. Pos
# source: root display_HDR_image
# Preview:
# id: qrcam
# canvas:
# color:
,1,1,1 # rgba: [1]
# a Rectangle:
# size: self. Width + 20, the self. The height + 20
# pos: self. Pos
# source: root display_HDR_image

BoxLayout:
Orientation: 'horizontal'
1
size_hint: 1,.Button:
Text: 'left'
On_press: root left ()
Button:
Text: 'right'
On_press: root. Right ()
Button:
Text: 'Back'
On_press:
Root. Exit_display ()
Root. The manager. The current='camera_screen'

"" ")


# Declare both screens
The class CameraScreen (Screen) :
Global camera_id # choose camera
Camera_id=0
Global preview_state # preview control whether open
Preview_state=True
Global compensation # exposure compensation
The compensation=1
# global camera
# camera=None

# global frame

Def selectCamera (self, I) :
"Select camera" "" ""
Global camera_id
Camera_id=I
Print (" selected camera "+ STR (camera_id))
# camera=self. The index=camera_id
Return camera_id

Def selectCompensation (self, I) :
Response set the exposure compensation "" "" ""
Global compensation
The compensation=I
Print (" selected compensation "+ STR (compensation))
Return the compensation

Def takePicture (self) :
Global compensation
Global camera_id
Global camera
Pic_list=[]
Take_picture_number=3
# self. Ids [' sjnCamera] play=False
CAM=cv2. VideoCapture (camera_id)
Exposure_list=self. GetExposureList (CAM, compensation) # get exposure sequence
CWD=OS. Getcwd ()
While take_picture_number:
For t in exposure_list:
CAM. Set (cv2 CAP_PROP_EXPOSURE, t)
Ret, frame_read=CAM. The read ()
If ret:
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related