shrink

ImageMagick: Is there an equivalent of Gimp's tool to “shrink” and “grow” a selection?

狂风中的少年 提交于 2019-12-25 03:44:46
问题 I have a black and white mask image produced with this ImageMagick command: convert in.jpg -threshold 85% out.png Giving me this result: I'd like to reduce the size of each piece like if I was doing it with Gimp by selecting the white background, inverting the selection and shrink it by X pixels. Is it possible to do it with ImageMagick and if yes, how ? 回答1: In Imagemagick, you can use -morphology close to reduce the white holes in the black. But if you use too large a kernel size, it will

Navigation Bar Shrinking after relaunching app

守給你的承諾、 提交于 2019-12-24 03:54:12
问题 I got a problem, I need to build something similar to this, where the red bar is a UIImageView and the blue bar is the navigation bar: http://imagizer.imageshack.us/v2/800x600q90/30/iqtt.png I was able to make it with the following code, my problem is that when I press home button to close the app and reopen it, my navigation bar shrinks, on the link image it has 88px and after relaunch 44px, so it mess with my layout. Here is the code I've used on viewDidAppear: - (void)viewDidAppear:(BOOL

QTableWidgetItem shrinking

随声附和 提交于 2019-12-12 04:23:18
问题 I have an issue usign QTableWidgetItem. I normally use the QTableWidget like this this->setItem(i, j, new QTableWidgetItem()); this->item(i, j)->setText(string); The column I'm writing to is narrow, only about 20px. I need to write 2 digits in there and from the definition I cannot resize the column. The problem is that once the text overlaps the column width, it totally disappears and only three dots (or even nothing) appear instead. Can I suppress this behavior? I dont mind if there will be

android - expand and shrink circle on google map

本秂侑毒 提交于 2019-12-11 18:25:39
问题 I'm trying to draw a resizable circle on google map, which the user will be able to expand or shrink using touch gestures and also want it to work like zooming in/out option in the map, only that just the circle will get bigger/smaller on the map. I can draw a circle on the map but i don't know how to get it to respond to touch events. Here is my code MainActivity.java public class MainActivity extends FragmentActivity implements LocationListener { GoogleMap googleMap; @Override protected

Shrink string encoding algorithm

蹲街弑〆低调 提交于 2019-12-10 11:14:42
问题 How do we shrink/encode a 20 letter string to 6 letters. I found few algorithms address data compression like RLE, Arithmetic coding, Universal code but none of them guarantees 6 letters. The original string can contain the characters A-Z (upper case), 0-9 ans a dash. 回答1: If your goal is to losslessly compress or hash an random input string of 20 characters (each character could be [A-Z], [0-9] or -) to an output string of 6 characters. It's theoretically impossible. In information theory,

refering to already existing group in regex, c#

若如初见. 提交于 2019-12-08 08:39:09
问题 I have a regex where %word% can occur multiple times, separated by a "<" %word% is defined as ".*?"|[a-zA-Z]+ so i wrote (".*"|[a-zA-Z]+)([<](".*"|[a-zA-Z]+))* Is there any way i can shrink it using capturing groups? (".*"|[a-zA-Z]+)([<]\1)*, But i don't think \1 can be used as it'd mean repeat the first capture, as i would not know what was captured as it can be a quoted string or a word. Any thing similar i can use to refer matching the previously written group. I'm working in C#. 回答1:

How do android:shrinkColumns and android:stretchColumns work?

两盒软妹~` 提交于 2019-12-07 03:02:16
问题 I can set android:shrinkColumns and android:stretchColumns at TableLayout . For example: <TableLayout android:shrinkColumns="2,3" android:stretchColumns="1,3" android:layout_width="match_parent" android:layout_height="wrap_content"/> So how do this properties affects columns? 回答1: TableLayout can specify certain columns as shrinkable or stretchable by calling setColumnShrinkable()(xml:android:shrinkColumns) or setColumnStretchable()(xml:android:stretchColumns) . If marked as shrinkable , the

refering to already existing group in regex, c#

蹲街弑〆低调 提交于 2019-12-06 20:31:26
I have a regex where %word% can occur multiple times, separated by a "<" %word% is defined as ".*?"|[a-zA-Z]+ so i wrote (".*"|[a-zA-Z]+)([<](".*"|[a-zA-Z]+))* Is there any way i can shrink it using capturing groups? (".*"|[a-zA-Z]+)([<]\1)*, But i don't think \1 can be used as it'd mean repeat the first capture, as i would not know what was captured as it can be a quoted string or a word. Any thing similar i can use to refer matching the previously written group. I'm working in C#. using String.Format to avoid repetition and no there is no way to repeat the regex group literally String.Format

How to get the first n elements of a std::map

不羁岁月 提交于 2019-12-06 01:35:34
问题 Since there is no .resize() member function in C++ std::map I was wondering, how one can get a std::map with at most n elements. The obvious solution is to create a loop from 0 to n and use the nth iterator as the first parameter for std::erase(). I was wondering if there is any solution that does not need the loop (at least not in my user code) and is more "the STL way to go". 回答1: You can use std::advance( iter, numberofsteps ) for that. 回答2: Universal solution for almost any container,

Why isn't realloc shrinking the array?

﹥>﹥吖頭↗ 提交于 2019-12-04 06:18:22
问题 I have trouble reducing the size of dynamically created array. Here's what my main function looks like: int main(void) { // Intialize big array int * a = (int *)malloc(10*sizeof(int)); assert(a); // Fill it with squares for (int i = 0; i < 10; ++i) a[i] = i*i; // Expected to print 64 printf("%d\n", a[8]); // Shrink the big array int * b = (int *)realloc(a, 5*sizeof(int)); assert(b); // Expected to cause SEGFAULT printf("%d\n", b[8]); return 0; } Everything works fine except for printf("%d\n",