threshold


ImageMagick - How do I flatten white levels to pure white?

倖福魔咒の 提交于 2020-01-13 02:53:10
问题 I have a png image with a white background which I'd like to turn transparent. This is fairly simple with this command: $ convert image.png -transparent white image-trans.png However, if the white background is not completely white (i.e, #FFFFFF , rgb(255,255,255) , etc), then this doesn't work well. Is there a way to set reduce everything below a certain threshold to complete white? Thanks. 回答1: The commandline option you are looking for is -white-threshold value{%} So a command of convert

Object detecting using thresholding

蹲街弑〆低调 提交于 2020-01-10 04:23:20
问题 I'm working on a program in matlab to detect an object in a sequence of images. The object I'm trying to detect a red ball. First, I tried to use thresholding to segment the ball from the image, but I couldn't do that. I couldn't get rid of the shadow under the ball. Any Ideas how to get rid of the small part under the ball? My second question is, I want to make sure that the object I'm looking for is a red ball. my code will detect any red object, I want to make sure its a circle. My code:

OpenCV threshold with mask

こ雲淡風輕ζ 提交于 2020-01-06 16:20:56
问题 I'm trying to use OpenCV's cv::threshold function (more specific THRESH_OTSU ), only that I'd like to do it with a mask (any shape), so that the outside (background) is ignored during calculation. Image is single channel (as it must be), red color bellow is only to mark an example polygon on an image. I tried using adaptiveThreshold , but there are a couple of problems that make it inappropriate in my case. 回答1: In general, you can simply compute the threshold using cv::threshold , and then

Compare two vectors of numbers based on threshold of tolerance (±) of 0.5

浪尽此生 提交于 2020-01-05 04:22:07
问题 I have two vectors g and h . I want to compare the numbers in these two vectors and find out whether there are any common elements between them. But the common elements do not have to be exactly the same and can be within a range of (-0.5, +0.5) . Therefore, g±0.5 is being compared with h±0.5 . g <- c(0.5, 5956.3, 38, 22.666, 590.3, 21.992, 9.3) h <- c(0.7, 99.2, 39, 30, 21.68, 9.4, 22.333, 0.001, 0.000222, 9.999) As an example, in the two vectors above, 0.5 from g and 0.7 from h match

R: Finding the nearest raster cell within a threshold calculated between two rasters

♀尐吖头ヾ 提交于 2020-01-01 23:19:50
问题 I have two perfectly overlapping rasters (same extents and cell size). For every cell in one raster (i.e. for every XY), I would like to determine the Euclidean geographical distance to the closest cell within a given threshold difference between the rasters. Put another way: raster1 and raster2 measure some variable Z. I have a threshold difference for Z values (t) which constitutes a "matching" value (or "close enough") between raster1 and raster2. For each reference cell in raster1, I need

How do I define color groups based on numerical threshold values for ggplot2 scatterplot

夙愿已清 提交于 2020-01-01 11:39:00
问题 I have a data set that contains 2 variables x = event number & y = assay amplitude. I am trying to create a scatterplot in ggplot2 where all of the points that are > 3000 are colored in one color and all of the points < 3000 are in a different color. I can get the plot and change the color for all data points, but can't figure out how to define a color scheme based on the value threshold. Here is a sample of the data I'm using: dat <- data.frame(x=c(399, 16022, 14756, 2609, 1131, 12135, 7097,

Return coordinates that passes threshold value for bounding boxes Google's Object Detection API

陌路散爱 提交于 2019-12-31 03:55:25
问题 Does anyone know how to get bounding box coordinates which only passes threshold value? I found this answer (here's a link), so I tried using it and done the following: vis_util.visualize_boxes_and_labels_on_image_array( image, np.squeeze(boxes), np.squeeze(classes).astype(np.int32), np.squeeze(scores), category_index, use_normalized_coordinates=True, line_thickness=1, min_score_thresh=0.80) for i,b in enumerate(boxes[0]): ymin = boxes[0][i][0]*height xmin = boxes[0][i][1]*width ymax = boxes

Threshold frequency is not working in spell check in Solr

半世苍凉 提交于 2019-12-24 04:27:07
问题 I am get stuck in middle of Solr . I need only most popular words w.r.t query . I have used phonetic filter on both index and query but here the problem is that it is giving too many terms . I need only few terms which are very specific to the query . schema.xml <fieldType name="textSpell" class="solr.TextField" positionIncrementGap="100"> <analyzer type="index"> <filter class="solr.TrimFilterFactory"/> <filter class="solr.LowerCaseFilterFactory"/> <tokenizer class="solr

Finding several regions of interest in an array

匆匆过客 提交于 2019-12-23 17:24:42
问题 Say I have conducted an experiment where I've left a python program running for some long time and in that time I've taken several measurements of some quantity against time. Each measurement is separated by some value between 1 and 3 seconds with the time step used much smaller than that... say 0.01s. An example of such an even if you just take the y axis might look like: [...0,1,-1,4,1,0,0,2,3,1,0,-1,2,3,5,7,8,17,21,8,3,1,0,0,-2,-17,-20,-10,-3,3,1,0,-2,-1,1,0,0,1,-1,0,0,2,0...] Here we have

HashMap原理(二)——jdk1.8中HashMap扩容底层代码和算法分析

放肆的年华 提交于 2019-12-22 16:24:16
记得曾经有个著名大师谁谁谁曾经说过:你有一个思想,我有一个思想,我们交换一下,一人就有两个思想;你有一个苹果,我有一个苹果,我们交换一下,一人还是一个苹果。那既然这样的话,用我的iPhone 7 换你的 iPhone 11 如何? 这次给大家带来的是HashMap原理第二篇之——HashMap扩容的底层代码和算法分析。需要说明的是本文是基于jdk1.8来进行展开的,今后有机会会和大家分享在jdk1.7中HashMap的实现方式和1.8有哪些区别(扩容方式是其中的区别之一)。有朋友会说,既然HashMap是基于数组+单向链表+红黑树的底层数据结构,链表可以无限地延伸啊,红黑树也可以不停滴往里面放东西啊,还扩容干什么?这样的说法既对也不对,说对是因为HashMap确实是基于单向链表和红黑树的,但是有没有想过不断地往链表上添加元素或者不断地往树里面加东西会怎么样?是不是会导致链表过长以及树的深度增大?是不是进而会提高遍历链表或者红黑树的时间复杂度?最终导致从表现上来看插入和查找操作会越来越慢?所以,到了一定程度对数组扩容还是很有必要的。那又有朋友会问:扩容很简单啊,需要的时候从数组两端往外延伸一下内存空间不就可以了吗?……想啥呢?数组不是拉面,需要的时候从两边往外抻一下,不存在的!数组扩容只能开辟出一个更大的内存空间出来,将原来的内容迁移到新的内存空间里面。OK

工具导航Map