openCV AdaptiveThreshold versus Otsu Threshold. ROI

I'm tried to use both of the methods but it seems like Adaptive threshold seems to be giving a better result. I used cvSmooth( temp, dst,CV_GAUSSIAN,9,9, 0); on the original image then only i used the threshold. Is there anything I can tweak with the Otsu method to make the image better like adaptive thresholding? And 1 more thing, there are some unwanted fingerprint residue on the sid

openCV AdaptiveThreshold与Otsu阈值。 投资回报率

我试图使用这两种方法,但似乎自适应阈值似乎给出了更好的结果。 我用了 cvSmooth( temp, dst,CV_GAUSSIAN,9,9, 0); 在原始图像上,那么只有我使用了阈值。 有什么我可以用大津方法调整,使图像更好像自适应阈值? 还有一件事,一边有一些不必要的指纹残留,任何想法如何我可以将它们处理掉? 我从日记中读到,通过比较自定义正方形中白色像素的百分比,我可以得到ROI。 然而,这种方法要求我有一个阈值,可以使用OTSU

C++11: does atomic::compare

I've got the following code: #include<atomic> #include<iostream> using namespace std; struct Big{ int i; int j; int k[100]; }; int main(){ atomic<int> i; cout<<i.load()<<endl; i.store(20); cout<<i.load()<<endl; i.exchange(30); cout<<i.load()<<endl; atomic<Big> ab,expect,value; ab.compare

C ++ 11:确实是atomic :: compare

我有以下代码: #include<atomic> #include<iostream> using namespace std; struct Big{ int i; int j; int k[100]; }; int main(){ atomic<int> i; cout<<i.load()<<endl; i.store(20); cout<<i.load()<<endl; i.exchange(30); cout<<i.load()<<endl; atomic<Big> ab,expect,value; ab.compare_exchange_weak(exp

safe increment with modulo without mutex using std::atomic

I need a thread-safe pool of Buffer-objects used in a round-robin fashion. I normally would just put a mutex in there to make the increment and modulo thread safe, but is it possible to write it using std::atomic? Here's a sample interface. If it makes things easier the total number of buffers can be a power of two. The next buffer index is never accessed outside of the class. class Buff

使用std :: atomic的无模互斥模的安全增量

我需要一个以循环方式使用的线程安全的Buffer对象池。 我通常会在那里放置一个互斥体,以使增量和模数线程安全,但可以使用std :: atomic写入它吗? 这里有一个示例界面。 如果它使事情更容易,缓冲区的总数可以是2的幂。 下一个缓冲区索引永远不会在类之外访问。 class Buffer; class BufferManager { public: BufferManager( size_t totalBuffers = 8 ) : mNextBufferIndex( 0 ), mTotalBuffers( totalBuffers )

Sharing information between threads using mutex vs messages

Edit : My question is still unanswered if anyone would like to take a shot at it In my MFC C++ application, I share information between GUI thread and worker thread as shown in the following code. I have created a struct called inParams, which needs to be referenced from within both the main thread and the worker thread. Hence, I declare its members of std::atomic type, and in cases where ato

使用互斥锁与消息在线程之间共享信息

编辑:我的问题仍然没有答案,如果有人想对它进行拍摄 在我的MFC C ++应用程序中,我在GUI线程和工作线程之间共享信息,如以下代码所示。 我创建了一个名为inParams的结构,它需要在主线程和工作线程中引用。 因此,我声明了std :: atomic类型的成员,并且在原子类型不存在的情况下,例如。 对于花车,我使用专用的互斥体。 主线程使用此信息执行Foo操作,并且工作线程执行操作栏。 Foo和Bar同时运行,两者都可以看到对用

Understanding std::atomic::compare

bool compare_exchange_weak (T& expected, T val, ..); compare_exchange_weak() is one of compare-exchange primitives provided in C++11. It's weak in the sense that it returns false even if the value of the object is equal to expected . This is due to spurious failure on some platforms where a sequence of instructions (instead of one as on x86) are used to implement it. On such platforms,

了解std :: atomic :: compare

bool compare_exchange_weak (T& expected, T val, ..); compare_exchange_weak()是C ++ 11中提供的比较交换原语之一。 即使对象的值等于expected值,它也会返回false,因此它很弱 。 这是由于某些平台上的虚假故障导致一系列指令(而不是x86上的指令)用于实现它。 在这样的平台上,上下文切换,由另一个线程重新加载相同地址(或缓存行)等可能会使原语失败。 这是spurious因为它不是操作失败的对象的价值(不等于expe

C++11 multithreading locks and atomic primitives

(A question leading to two questions) In C++11 are locks atomic, in that one can be definitely assured two threads cannot acquire the lock at the same time? If the answer to the above is "yes", then what is the purpose of double-checked locking? Finally, why do we need std::lock() when we could just use an atomic primitive (which, obviously- we know is atomic ) and set this to 1 o

C ++ 11多线程锁和原子基元

(一个问题导致两个问题) 在C ++ 11中锁是原子的,因为可以肯定的是两个线程不能同时获得锁? 如果上述答案为“是”,那么双重锁定的目的是什么? 最后,为什么我们只需要使用原子基元(显然,我们知道它是原子的 )就需要std :: lock(),并根据是否获取锁定将其设置为1或0? 双重检查锁定背后的混淆理念是,在检查条件时不获取锁定,只能在不可能的情况下获取锁定。 然而,要实现这一点,仍然需要相当多的同步,这很

c++

Is it possible to safely move unique_ptr with c++11 atomic operations? Currently I have a code like this std::unique_ptr<SyncToken> DataManager::borrowSyncToken() { std::unique_lock<std::mutex> syncTokenLock(syncTokenMutex); return std::move(syncToken); } I am wondering whether there is some more elegant way, like simply declaring: std::atomic<std::unique_ptr<SyncTo

C ++

是否有可能使用c ++ 11原子操作安全地移动unique_ptr? 目前我有这样的代码 std::unique_ptr<SyncToken> DataManager::borrowSyncToken() { std::unique_lock<std::mutex> syncTokenLock(syncTokenMutex); return std::move(syncToken); } 我想知道是否有一些更优雅的方式,如简单地声明: std::atomic<std::unique_ptr<SyncToken>> syncToken; 并避免互斥的需要。 或者可能我根本不需要

Light and shadow not working in opengl and c++

I am creating the solar system and I keep running into problems with the lighting. The first problem is that the moon casts no shadows on the earth and the earth casts no shadows on the moon. The other problem is that the light that is shining on the the earth and the moon are not coming from my sun, but from the center point of the orbit. I added the red lines in the picture below to show wha

光影不在opengl和c ++中工作

我正在创建太阳能系统,并一直遇到照明问题。 第一个问题是月球在地球上没有阴影,地球在月球上没有阴影。 另一个问题是,照射在地球和月球上的光线不是来自我的太阳,而是来自轨道的中心点。 我在下面的图片中添加了红线以显示我的意思。 下面的图片应该说明我的两个问题。 这是处理灯光和行星的代码。 glDisable(GL_LIGHTING); drawCircle(800, 720, 1, 50); //SUN //Picture location, major

Add external libraries to CMakeList.txt c++

I have my external library as shown in this picture that I create the symbolic links after: and the headers related to the library in other file: I'm working with ROS ubuntu and I need to add these libraries to my package to CmakeList.txt : cmake_minimum_required(VERSION 2.4.6) include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake) rosbuild_init() #set the default path for built executab

将外部库添加到CMakeList.txt c ++

我有我的外部库,如下图所示,我创建后的符号链接: 和与其他文件中的库相关的标题: 我正在使用ROS ubuntu ,我需要将这些库添加到CmakeList.txt包中: cmake_minimum_required(VERSION 2.4.6) include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake) rosbuild_init() #set the default path for built executables to the "bin" directory set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) #set the default path

C++: Strange "is private" error

I've been getting a very unusual error from g++ claiming that a type alias is private. After hours of reducing my code, I've arrived at the following minimal test case: template <typename Dummy> class Test { struct CatDog { static void meow () { CrazyHouse::TheCatDog::meow(); } struct Dog { static void bark (); }

C ++:奇怪的是“私人”的错误

我从g ++得到一个非常不寻常的错误,声称类型别名是私有的。 在缩短我的代码几个小时之后,我已经到了以下最小的测试用例: template <typename Dummy> class Test { struct CatDog { static void meow () { CrazyHouse::TheCatDog::meow(); } struct Dog { static void bark (); }; }; struct CrazyHouse { using TheCatDog = C