converter

How to Convert Emgu.Cv.Image<Gray,byte> to System.Image

為{幸葍}努か 提交于 2019-12-07 05:29:39
问题 I was new to Emgu Cv and i was wondering if someone could let me know how i change Emgu.Cv.Image to System.Image?If there is a need for further explanation, let me know and i will do it.The language i am using is C#. 回答1: You can just use the ToImage() method to get a System.Drawing.Bitmap (which is a derived class of System.Drawing.Image ), so something like this // create an Emgu image of 400x200 filled with Blue color Image<Bgr, Byte> img = new Image<Bgr, byte>(400, 200, new Bgr(255, 0, 0)

How to convert a multi-page PDF to single-page TIFFs

♀尐吖头ヾ 提交于 2019-12-07 04:59:18
问题 This thread asks for how to convert multi-page PDF to multi-page TIFF with Ghostscript; "Tools to convert multipage PDF to multipage TIFF" However, I want to covert a multi page PDF to a number of single-page TIFFs: Each page in the PDF is expected to be converted to a single TIFF file. So the above answer does not exactly match what I need. How can I achieve this? I am using Windows XP. 回答1: Be sure to have a recent version of Ghostscript installed. Then you can run these commands: gs \ -o

XStream: Collapsing XML hierarchy as I parse

为君一笑 提交于 2019-12-07 03:45:00
问题 I have an XML document (generated by Adobe XFA forms), that contains data like the following: <Position> <PositionBorder> <Title/> <StartDate/> <EndDate/> </PositionBorder> </Position> Since this file is defined elsewhere, I am not at liberty to change the format of the XML that I get. In my Java code, I create a Position class that contains the Title, Start and End Dates. My problem is, when I use XStream to parse the file, it wants a PositionBorder class to hold the title and dates. I want

@Convert on @Id field

我怕爱的太早我们不能终老 提交于 2019-12-07 02:50:45
问题 I'm trying to @Id @Column(name = "MY_ID_FIELD") @Convert(converter = IdConverter.class) private Long id; IdConverter is: @Converter public class IdConverter implements AttributeConverter<Long, BigDecimal> { @Override public BigDecimal convertToDatabaseColumn(Long attribute) { return BigDecimal.valueOf(attribute); } @Override public Long convertToEntityAttribute(BigDecimal dbData) { return dbData.longValue(); } } The converter will map BigDecimal, the attribute field type Hibernate expects

WPF converter to update in real time background colour of textbox on text change

帅比萌擦擦* 提交于 2019-12-06 22:50:06
问题 I have two textboxes for the firstname and second name of a user and I have created a converter to change the background colour of the textbox when the text equals a specific string. The problem I am having is that the textbox will only update at run time and doesn't update when I change the text is the textbox. XAML: <TextBox x:Name="forenameTextBox" Grid.Column="1" HorizontalAlignment="Left" Height="23" Margin="3" Grid.Row="1" Background="{Binding Staff,Converter ={StaticResource

How to convert all *.potx files to *.pptx files with VBA?

半腔热情 提交于 2019-12-06 21:40:31
I have a folder of ~20 *.potx files and I would like to convert all *.potx files to *.pptx, then delete the *.potx files. The following will loop through all your templates, convert, and delete the template files. Sub loopFiles() Dim fso As New FileSystemObject Dim fil As File Dim fold As Folder Set fold = fso.GetFolder(yourFolder) For Each fil In fold.Files If InStr(1, fil.Name, ".potx") > 0 Then Application.Presentations.Open fil.Path ActivePresentation.SaveAs Replace(fil.Path, ".potx", ".pptx"), ppSaveAsDefault ActivePresentation.Close 'if you truly want to delete them, don't recommend

Remove currency symbols and literals from a string with a price universal solution

社会主义新天地 提交于 2019-12-06 21:17:39
I have such examples: USD 10.99 LIR10.99 $ 10.99 $10.99 So the input data may be any 'symbolfloat' or 'symbol float'. I have made something like this: float((str(param[2]).translate(None, '$USDLIR'))) But it can be any world currency, so it must be a universal converter. Remove anything from the string which isn't a digit or a decimal point: import re import locale decimal_point_char = locale.localeconv()['decimal_point'] clean = re.sub(r'[^0-9'+decimal_point_char+r']+', '', str(param[2])) value = float(clean) That will also handle grouping ( $ 1,000.00 ) and different locales. You can remove

WPF - Pass the value of one control to a Converter to set the width on another control

ⅰ亾dé卋堺 提交于 2019-12-06 19:06:18
问题 I want to set the width of a TextBlock based on the width of its container, minus the margins set on the TextBlock. Here is my code <TextBlock x:Name="txtStatusMessages" Width="{Binding ElementName=LayoutRoot,Path=ActualWidth }" TextWrapping="WrapWithOverflow" Foreground="White" Margin="5,5,5,5">This is a message </TextBlock> And that works great except for the fact that the TextBlock is 10 units too big due to the Left and Right Margins bbeing set to 5. OK, so I thought... Let's use a

Facelet selectOneMenu with POJOs and converter problem

浪子不回头ぞ 提交于 2019-12-06 15:49:54
I want to have a facelet page with a formular and a dropdown menu. With the dropdown menu the user shoul select a POJO of the type Lieferant: public class Lieferant extends AbstractPersistentWarenwirtschaftsObject { private String firma; public Lieferant(WarenwirtschaftDatabaseLayer database, String firma) { this(database, null, firma); } public Lieferant(WarenwirtschaftDatabaseLayer database, Long primaryKey, String firma) { super(database, primaryKey); this.firma = firma; } public String getFirma() { return firma; } @Override public String toString() { return getFirma(); } @Override public

WPF Converter Property

泪湿孤枕 提交于 2019-12-06 15:41:04
问题 I have a converter that in code I can set a property like: tabAssumptions.SetBinding(UIElement.VisibilityProperty, new Binding("CurrentPhase.IsWholeScheme") { Converter = new BoolToVisibilityConverter { Inverse = true } }); How can I set the Inverse property of the converter when used in XAML? 回答1: My BoolToVisibilityConverter is below. You can either use it as a resource: <converters:BoolToVisibilityConverter x:Key="FalseToHidden" TrueValue="Visible" FalseValue="Hidden" /> or use it as a