Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
016011fd
Commit
016011fd
authored
Aug 27, 2015
by
Andrey Pavlenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing start faulure on some devices; syncronization improvements
parent
4b0f3bf1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
Camera2Renderer.java
...ncl/src/org/opencv/samples/tutorial4/Camera2Renderer.java
+11
-8
No files found.
samples/android/tutorial-4-opencl/src/org/opencv/samples/tutorial4/Camera2Renderer.java
View file @
016011fd
...
...
@@ -73,7 +73,6 @@ import android.view.Surface;
Math
.
abs
(
aspect
-
(
float
)
w
/
h
)
<
0.2
)
{
bestWidth
=
w
;
bestHeight
=
h
;
//mPreviewSize = psize;
}
}
Log
.
i
(
LOGTAG
,
"best size: "
+
bestWidth
+
"x"
+
bestHeight
);
...
...
@@ -156,9 +155,9 @@ import android.view.Surface;
@Override
public
void
onDisconnected
(
CameraDevice
cameraDevice
)
{
//mCameraOpenCloseLock.release();
cameraDevice
.
close
();
mCameraDevice
=
null
;
mCameraOpenCloseLock
.
release
();
}
@Override
...
...
@@ -185,6 +184,7 @@ import android.view.Surface;
return
;
}
if
(
null
==
mSTex
)
{
mCameraOpenCloseLock
.
release
();
Log
.
e
(
LOGTAG
,
"createCameraPreviewSession: preview SurfaceTexture is null"
);
return
;
}
...
...
@@ -192,7 +192,6 @@ import android.view.Surface;
mSTex
.
setDefaultBufferSize
(
mPreviewSize
.
getWidth
(),
mPreviewSize
.
getHeight
());
Surface
surface
=
new
Surface
(
mSTex
);
Log
.
d
(
LOGTAG
,
"createCameraPreviewSession: surface = "
+
surface
);
mPreviewRequestBuilder
=
mCameraDevice
.
createCaptureRequest
(
CameraDevice
.
TEMPLATE_PREVIEW
);
...
...
@@ -215,6 +214,7 @@ import android.view.Surface;
mCaptureSession
.
setRepeatingRequest
(
mPreviewRequestBuilder
.
build
(),
null
,
mBackgroundHandler
);
Log
.
i
(
LOGTAG
,
"CameraPreviewSession has been started"
);
}
catch
(
CameraAccessException
e
)
{
Log
.
e
(
LOGTAG
,
"createCaptureSession failed"
);
}
...
...
@@ -227,7 +227,7 @@ import android.view.Surface;
Log
.
e
(
LOGTAG
,
"createCameraPreviewSession failed"
);
mCameraOpenCloseLock
.
release
();
}
},
null
);
},
mBackgroundHandler
);
}
catch
(
CameraAccessException
e
)
{
Log
.
e
(
LOGTAG
,
"createCameraPreviewSession"
);
}
catch
(
InterruptedException
e
)
{
...
...
@@ -235,7 +235,7 @@ import android.view.Surface;
"Interrupted while createCameraPreviewSession"
,
e
);
}
finally
{
mCameraOpenCloseLock
.
release
();
//
mCameraOpenCloseLock.release();
}
}
...
...
@@ -262,12 +262,15 @@ import android.view.Surface;
@Override
protected
void
setCameraPreviewSize
(
int
width
,
int
height
)
{
//mPreviewSize = new Size(width, height);
if
(
!
cacPreviewSize
(
width
,
height
)
)
return
;
Log
.
i
(
LOGTAG
,
"setCameraPreviewSize("
+
width
+
"x"
+
height
+
")"
);
try
{
mCameraOpenCloseLock
.
acquire
();
if
(
!
cacPreviewSize
(
width
,
height
)
)
{
mCameraOpenCloseLock
.
release
();
return
;
}
if
(
null
!=
mCaptureSession
)
{
Log
.
d
(
LOGTAG
,
"closing existing previewSession"
);
mCaptureSession
.
close
();
mCaptureSession
=
null
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment