Merge branch 'master' of git://code.opencv.org/opencv
This commit is contained in:
commit
ae4ff999d7
@ -50,10 +50,10 @@ namespace cv { namespace gpu { namespace device
|
|||||||
__device__ uchar4 int_to_uchar4(unsigned int in)
|
__device__ uchar4 int_to_uchar4(unsigned int in)
|
||||||
{
|
{
|
||||||
uchar4 bytes;
|
uchar4 bytes;
|
||||||
bytes.x = (in && 0x000000ff) >> 0;
|
bytes.x = (in & 0x000000ff) >> 0;
|
||||||
bytes.y = (in && 0x0000ff00) >> 8;
|
bytes.y = (in & 0x0000ff00) >> 8;
|
||||||
bytes.z = (in && 0x00ff0000) >> 16;
|
bytes.z = (in & 0x00ff0000) >> 16;
|
||||||
bytes.w = (in && 0xff000000) >> 24;
|
bytes.w = (in & 0xff000000) >> 24;
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -548,12 +548,16 @@ void cv::gpu::integralBuffered(const GpuMat& src, GpuMat& sum, GpuMat& buffer, S
|
|||||||
cudaStream_t stream = StreamAccessor::getStream(s);
|
cudaStream_t stream = StreamAccessor::getStream(s);
|
||||||
|
|
||||||
DeviceInfo info;
|
DeviceInfo info;
|
||||||
|
cv::Size whole;
|
||||||
|
cv::Point offset;
|
||||||
|
|
||||||
if (info.supports(WARP_SHUFFLE_FUNCTIONS))
|
src.locateROI(whole, offset);
|
||||||
|
|
||||||
|
if (info.supports(WARP_SHUFFLE_FUNCTIONS) )
|
||||||
{
|
{
|
||||||
GpuMat srcAlligned;
|
GpuMat srcAlligned;
|
||||||
|
|
||||||
if (src.cols % 16 == 0 && src.rows % 8 == 0)
|
if (src.cols % 16 == 0 && src.rows % 8 == 0 && offset.x % 16 == 0 && offset.y % 8 == 0)
|
||||||
srcAlligned = src;
|
srcAlligned = src;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -575,19 +579,18 @@ void cv::gpu::integralBuffered(const GpuMat& src, GpuMat& sum, GpuMat& buffer, S
|
|||||||
srcAlligned = buffer;
|
srcAlligned = buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
sum.create(srcAlligned.rows + 1, srcAlligned.cols + 1, CV_32SC1);
|
sum.create(srcAlligned.rows + 1, srcAlligned.cols + 4, CV_32SC1);
|
||||||
|
|
||||||
if (s)
|
if (s)
|
||||||
s.enqueueMemSet(sum, Scalar::all(0));
|
s.enqueueMemSet(sum, Scalar::all(0));
|
||||||
else
|
else
|
||||||
sum.setTo(Scalar::all(0));
|
sum.setTo(Scalar::all(0));
|
||||||
|
|
||||||
GpuMat inner = sum(Rect(1, 1, srcAlligned.cols, srcAlligned.rows));
|
GpuMat inner = sum(Rect(4, 1, srcAlligned.cols, srcAlligned.rows));
|
||||||
|
|
||||||
cv::gpu::device::imgproc::shfl_integral_gpu(srcAlligned, inner, stream);
|
cv::gpu::device::imgproc::shfl_integral_gpu(srcAlligned, inner, stream);
|
||||||
|
|
||||||
if (srcAlligned.data != src.data)
|
sum = sum(Rect(3, 0, src.cols + 1, src.rows + 1));
|
||||||
sum = sum(Rect(0, 0, src.cols + 1, src.rows + 1));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -156,24 +156,44 @@ template<> struct ColorChannel<float>
|
|||||||
|
|
||||||
///////////////////////////// Top-level template function ////////////////////////////////
|
///////////////////////////// Top-level template function ////////////////////////////////
|
||||||
|
|
||||||
template<class Cvt> void CvtColorLoop(const Mat& srcmat, Mat& dstmat, const Cvt& cvt)
|
template <typename Cvt>
|
||||||
|
class CvtColorLoop_Invoker :
|
||||||
|
public ParallelLoopBody
|
||||||
{
|
{
|
||||||
typedef typename Cvt::channel_type _Tp;
|
typedef typename Cvt::channel_type _Tp;
|
||||||
Size sz = srcmat.size();
|
public:
|
||||||
const uchar* src = srcmat.data;
|
|
||||||
uchar* dst = dstmat.data;
|
|
||||||
size_t srcstep = srcmat.step, dststep = dstmat.step;
|
|
||||||
|
|
||||||
if( srcmat.isContinuous() && dstmat.isContinuous() )
|
CvtColorLoop_Invoker(const Mat& _src, Mat& _dst, const Cvt& _cvt) :
|
||||||
|
ParallelLoopBody(), src(_src), dst(_dst), cvt(_cvt)
|
||||||
{
|
{
|
||||||
sz.width *= sz.height;
|
|
||||||
sz.height = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for( ; sz.height--; src += srcstep, dst += dststep )
|
virtual void operator()(const Range& range) const
|
||||||
cvt((const _Tp*)src, (_Tp*)dst, sz.width);
|
{
|
||||||
}
|
int i = range.start;
|
||||||
|
const uchar* yS = src.data + src.step * i;
|
||||||
|
uchar* yD = dst.data + dst.step * i;
|
||||||
|
|
||||||
|
for ( ; i < range.end; ++i, yS += src.step, yD += dst.step )
|
||||||
|
cvt((const _Tp*)yS, (_Tp*)yD, src.cols);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
const Mat src;
|
||||||
|
Mat dst;
|
||||||
|
const Cvt cvt;
|
||||||
|
|
||||||
|
CvtColorLoop_Invoker(const CvtColorLoop_Invoker&);
|
||||||
|
const CvtColorLoop_Invoker& operator= (const CvtColorLoop_Invoker&);
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename Cvt>
|
||||||
|
void CvtColorLoop(const Mat& src, Mat& dst, const Cvt& cvt)
|
||||||
|
{
|
||||||
|
Range range(0, src.rows);
|
||||||
|
CvtColorLoop_Invoker<Cvt> invoker(src, dst, cvt);
|
||||||
|
parallel_for_(range, invoker);
|
||||||
|
}
|
||||||
|
|
||||||
////////////////// Various 3/4-channel to 3/4-channel RGB transformations /////////////////
|
////////////////// Various 3/4-channel to 3/4-channel RGB transformations /////////////////
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.opencv.test.highgui;
|
package org.opencv.test.highgui;
|
||||||
|
|
||||||
import org.opencv.core.MatOfByte;
|
import org.opencv.core.MatOfByte;
|
||||||
|
import org.opencv.core.MatOfInt;
|
||||||
import org.opencv.highgui.Highgui;
|
import org.opencv.highgui.Highgui;
|
||||||
import org.opencv.test.OpenCVTestCase;
|
import org.opencv.test.OpenCVTestCase;
|
||||||
import org.opencv.test.OpenCVTestRunner;
|
import org.opencv.test.OpenCVTestRunner;
|
||||||
@ -19,7 +20,20 @@ public class HighguiTest extends OpenCVTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testImencodeStringMatListOfByteListOfInteger() {
|
public void testImencodeStringMatListOfByteListOfInteger() {
|
||||||
fail("Not yet implemented");
|
MatOfInt params40 = new MatOfInt(Highgui.IMWRITE_JPEG_QUALITY, 40);
|
||||||
|
MatOfInt params90 = new MatOfInt(Highgui.IMWRITE_JPEG_QUALITY, 90);
|
||||||
|
/* or
|
||||||
|
MatOfInt params = new MatOfInt();
|
||||||
|
params.fromArray(Highgui.IMWRITE_JPEG_QUALITY, 40);
|
||||||
|
*/
|
||||||
|
MatOfByte buff40 = new MatOfByte();
|
||||||
|
MatOfByte buff90 = new MatOfByte();
|
||||||
|
|
||||||
|
assertTrue( Highgui.imencode(".jpg", rgbLena, buff40, params40) );
|
||||||
|
assertTrue( Highgui.imencode(".jpg", rgbLena, buff90, params90) );
|
||||||
|
|
||||||
|
assertTrue(buff40.total() > 0);
|
||||||
|
assertTrue(buff40.total() < buff90.total());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testImreadString() {
|
public void testImreadString() {
|
||||||
|
@ -52,6 +52,11 @@ void cv::fastNlMeansDenoising( InputArray _src, OutputArray _dst, float h,
|
|||||||
_dst.create(src.size(), src.type());
|
_dst.create(src.size(), src.type());
|
||||||
Mat dst = _dst.getMat();
|
Mat dst = _dst.getMat();
|
||||||
|
|
||||||
|
#ifdef HAVE_TEGRA_OPTIMIZATION
|
||||||
|
if(tegra::fastNlMeansDenoising(src, dst, h, templateWindowSize, searchWindowSize))
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (src.type()) {
|
switch (src.type()) {
|
||||||
case CV_8U:
|
case CV_8U:
|
||||||
parallel_for(cv::BlockedRange(0, src.rows),
|
parallel_for(cv::BlockedRange(0, src.rows),
|
||||||
|
@ -49,4 +49,8 @@
|
|||||||
|
|
||||||
#include "opencv2/photo/photo.hpp"
|
#include "opencv2/photo/photo.hpp"
|
||||||
|
|
||||||
|
#ifdef HAVE_TEGRA_OPTIMIZATION
|
||||||
|
#include "opencv2/photo/photo_tegra.hpp"
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -764,7 +764,7 @@ vector<int> leaveBiggestComponent(vector<ImageFeatures> &features, vector<Match
|
|||||||
for (size_t i = 1; i < indices_removed.size(); ++i)
|
for (size_t i = 1; i < indices_removed.size(); ++i)
|
||||||
LOG(", " << indices_removed[i]+1);
|
LOG(", " << indices_removed[i]+1);
|
||||||
LOGLN(").");
|
LOGLN(").");
|
||||||
LOGLN("Try to decrease --match_conf value and/or check if you're stitching duplicates.");
|
LOGLN("Try to decrease the match confidence threshold and/or check if you're stitching duplicates.");
|
||||||
|
|
||||||
features = features_subset;
|
features = features_subset;
|
||||||
pairwise_matches = pairwise_matches_subset;
|
pairwise_matches = pairwise_matches_subset;
|
||||||
|
@ -105,6 +105,7 @@ public abstract class SampleCvViewBase extends SurfaceView implements SurfaceHol
|
|||||||
if (bmp != null) {
|
if (bmp != null) {
|
||||||
Canvas canvas = mHolder.lockCanvas();
|
Canvas canvas = mHolder.lockCanvas();
|
||||||
if (canvas != null) {
|
if (canvas != null) {
|
||||||
|
canvas.drawColor(0, android.graphics.PorterDuff.Mode.CLEAR);
|
||||||
canvas.drawBitmap(bmp, (canvas.getWidth() - bmp.getWidth()) / 2, (canvas.getHeight() - bmp.getHeight()) / 2, null);
|
canvas.drawBitmap(bmp, (canvas.getWidth() - bmp.getWidth()) / 2, (canvas.getHeight() - bmp.getHeight()) / 2, null);
|
||||||
mHolder.unlockCanvasAndPost(canvas);
|
mHolder.unlockCanvasAndPost(canvas);
|
||||||
}
|
}
|
||||||
|
@ -110,6 +110,7 @@ public abstract class SampleCvViewBase extends SurfaceView implements SurfaceHol
|
|||||||
if (bmp != null) {
|
if (bmp != null) {
|
||||||
Canvas canvas = mHolder.lockCanvas();
|
Canvas canvas = mHolder.lockCanvas();
|
||||||
if (canvas != null) {
|
if (canvas != null) {
|
||||||
|
canvas.drawColor(0, android.graphics.PorterDuff.Mode.CLEAR);
|
||||||
canvas.drawBitmap(bmp, (canvas.getWidth() - bmp.getWidth()) / 2, (canvas.getHeight() - bmp.getHeight()) / 2, null);
|
canvas.drawBitmap(bmp, (canvas.getWidth() - bmp.getWidth()) / 2, (canvas.getHeight() - bmp.getHeight()) / 2, null);
|
||||||
mFps.draw(canvas, (canvas.getWidth() - bmp.getWidth()) / 2, 0);
|
mFps.draw(canvas, (canvas.getWidth() - bmp.getWidth()) / 2, 0);
|
||||||
mHolder.unlockCanvasAndPost(canvas);
|
mHolder.unlockCanvasAndPost(canvas);
|
||||||
|
@ -111,6 +111,7 @@ public abstract class SampleCvViewBase extends SurfaceView implements SurfaceHol
|
|||||||
if (bmp != null) {
|
if (bmp != null) {
|
||||||
Canvas canvas = mHolder.lockCanvas();
|
Canvas canvas = mHolder.lockCanvas();
|
||||||
if (canvas != null) {
|
if (canvas != null) {
|
||||||
|
canvas.drawColor(0, android.graphics.PorterDuff.Mode.CLEAR);
|
||||||
canvas.drawBitmap(bmp, (canvas.getWidth() - bmp.getWidth()) / 2, (canvas.getHeight() - bmp.getHeight()), null);
|
canvas.drawBitmap(bmp, (canvas.getWidth() - bmp.getWidth()) / 2, (canvas.getHeight() - bmp.getHeight()), null);
|
||||||
mFps.draw(canvas, (canvas.getWidth() - bmp.getWidth()) / 2, 0);
|
mFps.draw(canvas, (canvas.getWidth() - bmp.getWidth()) / 2, 0);
|
||||||
mHolder.unlockCanvasAndPost(canvas);
|
mHolder.unlockCanvasAndPost(canvas);
|
||||||
|
@ -218,6 +218,7 @@ public abstract class SampleViewBase extends SurfaceView implements SurfaceHolde
|
|||||||
if (bmp != null) {
|
if (bmp != null) {
|
||||||
Canvas canvas = mHolder.lockCanvas();
|
Canvas canvas = mHolder.lockCanvas();
|
||||||
if (canvas != null) {
|
if (canvas != null) {
|
||||||
|
canvas.drawColor(0, android.graphics.PorterDuff.Mode.CLEAR);
|
||||||
canvas.drawBitmap(bmp, (canvas.getWidth() - getFrameWidth()) / 2, (canvas.getHeight() - getFrameHeight()) / 2, null);
|
canvas.drawBitmap(bmp, (canvas.getWidth() - getFrameWidth()) / 2, (canvas.getHeight() - getFrameHeight()) / 2, null);
|
||||||
mHolder.unlockCanvasAndPost(canvas);
|
mHolder.unlockCanvasAndPost(canvas);
|
||||||
}
|
}
|
||||||
|
@ -218,6 +218,7 @@ public abstract class SampleViewBase extends SurfaceView implements SurfaceHolde
|
|||||||
if (bmp != null) {
|
if (bmp != null) {
|
||||||
Canvas canvas = mHolder.lockCanvas();
|
Canvas canvas = mHolder.lockCanvas();
|
||||||
if (canvas != null) {
|
if (canvas != null) {
|
||||||
|
canvas.drawColor(0, android.graphics.PorterDuff.Mode.CLEAR);
|
||||||
canvas.drawBitmap(bmp, (canvas.getWidth() - getFrameWidth()) / 2, (canvas.getHeight() - getFrameHeight()) / 2, null);
|
canvas.drawBitmap(bmp, (canvas.getWidth() - getFrameWidth()) / 2, (canvas.getHeight() - getFrameHeight()) / 2, null);
|
||||||
mHolder.unlockCanvasAndPost(canvas);
|
mHolder.unlockCanvasAndPost(canvas);
|
||||||
}
|
}
|
||||||
|
@ -218,6 +218,7 @@ public abstract class SampleViewBase extends SurfaceView implements SurfaceHolde
|
|||||||
if (bmp != null) {
|
if (bmp != null) {
|
||||||
Canvas canvas = mHolder.lockCanvas();
|
Canvas canvas = mHolder.lockCanvas();
|
||||||
if (canvas != null) {
|
if (canvas != null) {
|
||||||
|
canvas.drawColor(0, android.graphics.PorterDuff.Mode.CLEAR);
|
||||||
canvas.drawBitmap(bmp, (canvas.getWidth() - getFrameWidth()) / 2, (canvas.getHeight() - getFrameHeight()) / 2, null);
|
canvas.drawBitmap(bmp, (canvas.getWidth() - getFrameWidth()) / 2, (canvas.getHeight() - getFrameHeight()) / 2, null);
|
||||||
mHolder.unlockCanvasAndPost(canvas);
|
mHolder.unlockCanvasAndPost(canvas);
|
||||||
}
|
}
|
||||||
|
@ -218,6 +218,7 @@ public abstract class SampleViewBase extends SurfaceView implements SurfaceHolde
|
|||||||
if (bmp != null) {
|
if (bmp != null) {
|
||||||
Canvas canvas = mHolder.lockCanvas();
|
Canvas canvas = mHolder.lockCanvas();
|
||||||
if (canvas != null) {
|
if (canvas != null) {
|
||||||
|
canvas.drawColor(0, android.graphics.PorterDuff.Mode.CLEAR);
|
||||||
canvas.drawBitmap(bmp, (canvas.getWidth() - getFrameWidth()) / 2, (canvas.getHeight() - getFrameHeight()) / 2, null);
|
canvas.drawBitmap(bmp, (canvas.getWidth() - getFrameWidth()) / 2, (canvas.getHeight() - getFrameHeight()) / 2, null);
|
||||||
mHolder.unlockCanvasAndPost(canvas);
|
mHolder.unlockCanvasAndPost(canvas);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user