|
rengaramu r wrote: s'nt enough for me to comparing images bcoz it's too simple
for my project i need complexity for my project to compring images if u knw help me
Comparing two images for equality only will always be simple - in fact, simpler than what you have already. Since you're only interested in equality, you should stop and return false as soon as you find one pixel different.
Now, if you're talking about image similarity, that can be very complex, in fact complex enough for graduate theses and Google R&D. Google has tried for many years to understand image similarity, and they do a pretty good job, but that is getting into a seriously complex area, and frankly, you don't seem to be ready for that.
However, you should be able to examine all the pixels, compare their distance away from each other (in terms of color values), then average those distances together, and it will give you a SIMPLE correlation value of how similar the images are. The code for that is simple...
foreach (px1, px2 in image) {
distance += SQRT( ((px1.red - px2.red)^2) + ((px1.blue - px2.blue)^2) + ((px1.green - px2.green)^2) )
numPix++;
}
correlation = distance/numPix;
Lower numbers indicate similarity. However, there are many problems with this algorithm, such as the fact that two pictures of the same thing, with a row of pixels added to one, will have a very high number, simply because the pixels don't line up. Any human looks at the two images and says "those are the same" but the computer fails at that.
Google and others now have image comparison tech that will give you a result like "those two images are both of a human face" and even go so far as "yes, there are faces in both images, and yes they are the same person" - right? That's what we call facial recognition software, but at its core that technology is image comparison and computer vision stuff.
|
|
|
|
|
thank u for ur reply yeah i got sme idea i tried to change it out
|
|
|
|
|
Good luck! There is really no middle ground - image comparison is either really simple, or ridiculously complex.
|
|
|
|
|
Well it sounds like your writing a windows program, this is the asp.net forum for web developers.
I'm not sure which forum is for windows managed code.
Anyways, if you had 2 identical images, actually the same image, then you could probably inspect each pixel in the image in the rows and columns, by color number, and see how many matches you get which should be 100%
But if you have 2 different sources for the image, and use a jpeg reducer, they may not compress the same leaving the image colors different so your match may only be 80% or none at all, even though they look the same to the human eye. The 2nd image may be offset by 1 row in the X or Y alignment creating a 0 match.
I've done work using pixels to determine the background color of an image, for automatic background color selection, and it took alot more code than what you posted to extract a good value.
You should probably Google the subject for awhile and look deeper into the subject.
|
|
|
|
|
I have programmatically generated a DataTable in ASP.NET 3.5 and now I want to use group by and do some calculations using SQL on this DataTable.
My question is: Is it possible to write a new SQL query against this DataTable and generate a new updated DataTable?
For eg:
select ID,sum(Rate) from dataTable group by ID
Sumit Kathuria
modified 28-Mar-13 14:26pm.
|
|
|
|
|
I've never seen it done.
You could push the datatable up to the SQL server in a #TEMP table, then do your SQL from there.
Not necessarily the best way to do things, but it would work.
|
|
|
|
|
You can use Linq Or Lamda Expression to form such query
DataTable dt = new DataTable();
dt.Columns.Add("ID");
dt.Columns.Add("Rate");
dt.Rows.Add("1", "10");
dt.Rows.Add("1", "20");
dt.Rows.Add("2", "30");
dt.Rows.Add("2", "40");
var result = dt.AsEnumerable().GroupBy(row => row["ID"]).Select(GroupedRows => new { ID = GroupedRows.Key, SumOfRate = GroupedRows.Sum(row => Convert.ToDecimal(row["Rate"])) }).ToList();
|
|
|
|
|
I have developed a new ASP.NET (4) website on my client's domain using a server dedicated to me (it also runs SQL Server.) The problem is, I need to knwo who's accessing the site, and I can't seem to get Windows authentication to work for my users (works fine for me and at least one other....) In my global.aspx page, I look for authenticated users, and set up security. But my users are coming through with anonymous authentication. When I disable anonymous authentication, they get an HTTP:400 rejection.
I don't know where to look. I'm no IIS (7) expert, but I've tried every suggestion I can find on the forums, and I can't figure it out. Here's what I know so far...
...Windows Integrated security is enabled on my users' browsers (IE8/32bit)
...I've disabled Anonymous access to my site (HTTP://Servername/Timesheets/) and enabled Windows Authentication.
...I've set up my Web.Config file:
<authentication mode="Windows"/>
<authorization>
<deny users="?"/>
<allow users="*"/>
</authorization>
I can't even get any responses on the forums. Can anyone walk me through the process?
Jim
|
|
|
|
|
Hi guys,
I am beginner in MVC 4, I am facing problem to achieve one simple requirement. The problem described as below.
I have 3 roles(Programmer,reviewer,Admin) and 1 razor view, that has 4 panels and each panel has set of controls , depends on the role and the some condition i have to make panels visible false/true.
Please help me out.
Thanks and regards
Vishwa
|
|
|
|
|
In the Mvc application we can find ASPNETDB.MDF in Server Explorer.
Add roles (Programmer,reviewer,Admin) and its users to respective tables.
Now based on the logged-in user's role we can make panel visible property true or false.
Sample Code:
if (User.IsInRole("Administrator"))
adminPanel.Visible=True;
I hope this will help you.
Please accept it as answer if it helped you.
With Regards,
Rohith.
|
|
|
|
|
I'm pretty new to ASP.NET, building my first simple website using C#/RazorV2, hosting it on the free Windows Azure site.
I've found plenty of articles explaining how the URL structure works, and I've mostly got it figured out, but what I'm wondering is, what's the best/safest/most correct way of doing it?
Is it better to actually have multiple smaller files to handle things? Or is it "OK" or accepted to have one file handle several things?
For example, I'm building a simple blog web app, and right now I'm using single files to handle multiple sections, like I have a Blog.cshtml:
if (urlDepth > 0) {
renderPost = new List<BlogPost>();
switch (UrlData[0]) {
case "Post":
int _postID = 0;
_postID = Convert.ToInt32(UrlData[1]);
renderPost.Add(blogRender.ShowSinglePost(_postID));
Page.Title = renderPost[0].Name;
break;
case "Category":
BlogCategory selCat = catDisplay.GetCategory(UrlData[1]);
Page.Title = selCat.Name;
renderPost = blogRender.PostsInCategory(selCat.ID);
break;
}
} else {
renderPost = blogRender.MultiplePosts(10);
}
I know it's a bit crude as it is, but it's a work-in-progress, I plan on making it more failsafe as I go. But before I get too deep into it and possibly end up needing to tear it apart, would it be better to actually just make a folder named Blog, and have separate Post.cshtml and Category.cshtml files to handle their respective areas?
Figure it's best to know now so I can fix it if need be, rather than find out down the road that I messed up and have to try and pry apart the code.
If someone wants to see it in action to get a better idea of what I'm doing, it's currently at http://vouksh.azurewebsites.net/
|
|
|
|
|
IMO it is okay to handle differrent permission for the same thing, i.e. the admin can delete a blog post on the same page as a user can view blog posts.
I would not use the same page for Categories and blog posts because they are two different things.
The more features/things which can be display (categories, blog posts etc.) you add to a page the more crowded the pages' code behind gets and sooner or later you will loose the overview.
|
|
|
|
|
|
I have a checkboxlist populated by a datasource having a textbox as a controlparameter. The checkboxlist is located within a modalpopup. When I click the button, the checkboxlist shows the list pertaining to the previous select. If I close and click the button to show the modalpopup, the second click shows the updated checkboxlist. I've tried everything I can think of and nothing seems to work. The latest attempt is to have a dummy button (arcArcPat) for the modalpopup. I click on btnPrePat to get the dynamic checkbox, but no modalpopup appears. Of course, when I click on btnArcPat, everything's great because I've clicked on the btnPrePat first. I tried taking away the display:none; and then I only get a flash on the screen, nothing that stays. Help?
<pre lang="vb"><asp:Button ID="btnPrePat" runat="server" Text="pre arc" /><asp:Button ID="btnArcPat" runat="server" text="Search" />
<ajaxToolkit:ModalPopupExtender ID="mpePat" runat="server" TargetControlID="btnArcPat" PopupControlID="mpPat" DropShadow="true" BackgroundCssClass="modalBackground"></ajaxToolkit:ModalPopupExtender>
<asp:Panel ID="mpPat" runat="server" CssClass="modalPopup" Style="display: none;">
<asp:CheckBoxList ID="cblPat" runat="server" RepeatDirection="Vertical" Font-Size="12px" />
<asp:Button ID="btnPatClose" runat="server" Text="Close" />
</asp:Panel>
Protected Sub btnPrePat_Click(sender As Object, e As EventArgs) Handles btnPrePat.Click
ds = New Data.DataSet
strSql = "SELECT TOP (100) PERCENT t.patID, myType FROM blah, blah"
da = New Data.SqlClient.SqlDataAdapter(strSql, cn)
Try
da.Fill(ds, "patSearch1")
If ds.Tables("patSearch1").Rows.Count > 0 Then
cblPat.DataSource = ds.Tables("patSearch1")
cblPat.DataTextField = ds.Tables("pat").Columns("myType").ToString
cblPat.DataValueField = ds.Tables("pat").Columns("patID").ToString
cblPat.DataBind()
End If
Catch ex As Exception
Response.Write(ex.ToString)
End Try
mpePat.Show()
End Sub
</pre>
|
|
|
|
|
For anyone else, - just wanted you to know that I figured out the bigger problem. Something must have corrupted the ajaxcontroltoolkit installation just enough. Once I re-referenced it, everything started working fine. Sorry for the trouble and thanks for your help.
|
|
|
|
|
<form id="MonthlyAward" action="@Url.Action("SubmitAwards", "MonthlyAward")" method="post">
@Html.DropDownListFor(m => m.ddlProjectsID, Model.ProjectNames, "--Select--", new { id = "ddlProjects",name="ddl_ProjectnameText", onchange = "document.getElementById('TheForm').submit();" })
how to get selected item text in form collection
[HttpPost]
public ActionResult SubmitAwards(FormCollection collection, MonthlyAwardModel award)
{
string strProjectId = collection["ddlProjectsID"].ToString().Trim();
return View();
|
|
|
|
|
There are two ways.
1. Have a hidden field in the page and set the value of that field as
$("#hiddendfield").val($("#ddlProjectsID option:selected").text());
You need to this on OnChange event of the dropdown. after that call the form submit method. it will be better if you use $.ajax of the jquery for submission.
Then in by using formcollection you can get the value of that hidden field in the controller.
2. have the list again in the controller and fire a query in that list against the id selected. now you have the selected item and you can get the display text
|
|
|
|
|
I want to use this code
TextBox1.DataBindings.Add("Text",DataTable,"FName");<
in web application project but it does,t have the library.in web form the library is in the system.windows.forms.controlbindingscoll… but I can,t handle it in web application.what is the solution?
|
|
|
|
|
behrad kiani wrote: what is the solution?
IMO the best way for using databindings in a ASP.NET web application is to start with MVC[^].
Hope it helps you.
|
|
|
|
|
I m developing simple multiuser chat application in asp.net c# for my website.I have a table name chat in database.i have a chat.aspx.cs page which contains getmessage() addmessage() methods.i created 1 class file which contains getpreviousmsgcount() and newmsgcount() methods which returns the Count of total records in Chat table.now what i did is i drag two timers on my chat aspx page.
on timer1 tick event i retrieve prevmsgcount() and timer2 tick event i retrieve newmsgcount(),timer1 tick event get fired before timer 2.And in timer 2 i applied a following logic
if(newmgcount>prevmsgcount)
then refresh a page(so getmessage() gets called again and new messages are added).But in this case i observed timers keep on refreshing page on time interval."if" condition is getting ignored.how to ping sql server continously and track insertion of new record?is der any other way without using timer controls?
<b>Plz help with the code of C# and asp.net only.
Thanks in Advance.</b>
|
|
|
|
|
Can anyone send the links for ebook and preparation material of 70-487 Exam??
|
|
|
|
|
Have you tried to search for it with Google?
Use the best guess
|
|
|
|
|
i am disabling past dates and remaining dates in green color with the following code
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{if (e.Day.Date < DateTime.Today)
{
e.Day.IsSelectable = false;e.Cell.ForeColor = System.Drawing.Color.Gray;
}
else
{
e.Cell.ForeColor = System.Drawing.Color.Green;
} }
i have two dropdownlists ddlFrom and ddlTo.i vil select dates from these dropdownlists to book a room in a hotel.the dates fromdate to todate should appear in red color...any help is appreciated
|
|
|
|
|
Member 8701813 wrote: .any help is appreciated
Can you be specific on what kind of help you seek?
You shared the colors of dates in a calendar, next you talk of having start-end date in red color, what does it mean?
What exactly are you trying to do? Where are you stuck specifically when you tried?
|
|
|
|
|
i mean , i vil select dates from dropdown lists namely ddlfrom and ddlto dropdownlists to book a room in hotel.in a calender these dates which are selected from the above mentioned dropdownlists should appear in red color...which indicates those dates are booked....available dates are in green color...only dates which are in green color the user can book....red colored dates he cannot book...i tried this in selection_changed event ...but i couldn't meet this requirement...
|
|
|
|