Raminator's Profile User Rating: ***--

Reputation: 0 Apprentice
Group:
Active Members
Active Posts:
284 (0.32 per day)
Joined:
16-July 12
Profile Views:
7,156
Last Active:
User is offline Apr 25 2014 10:56 AM
Currently:
Offline

Previous Fields

Country:
BR
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
AMD
Favorite Gaming Platform:
PC
Your Car:
Who Cares
Dream Kudos:
0

Latest Visitors

Icon   Raminator Begginer programer.Experient noob.

Posts I've Made

  1. In Topic: ANPR with Python

    Posted 15 Apr 2014

    The code right now, still no solution for image readings.
            #!/usr/bin/python2
    import cv
    import cv2
    import copy
    import numpy
    import math
    import os
    # import matplotlib.pyplot as plt # crashes when using opencv windows
    import Gnuplot
    
    gp = Gnuplot.Gnuplot()
    gp("set style data lines")
    
    gost_width = [520.0, 408.0]
    gost_height = 112.0
    gost_ratio = [gost_height / w for w in gost_width]
    min_error = 0.15;
    
    path = "C:/Users/Arengorn/Desktop/testsnaps/"
    img_index = 0
    min_index = 0
    max_img_index = len(os.listdir(path)) - 1
    line_index = 0
    
    def rms(values):
            rms = 0.0
            for v in values:
                    rms += v**2;
            rms = math.sqrt(rms / len(values))
    
            return rms
    
    def sma(values, size):
            new_values = []
            for i in range(len(values) - size):
                    new_values.append(sum(values[i:i+size]) / float(size))
            return new_values
    
    def compute():
            img_src = cv2.imread(path + "%d1.jpg" % img_index)
            img = cv2.cvtColor(img_src, cv.CV_RGB2GRAY)
            img = cv2.blur(img, (3, 3))
            #img = cv2.Canny(img, 400, 300)
            #retval, img = cv2.threshold(img, 100, 255, cv2.THRESH_BINARY)
            img = cv2.adaptiveThreshold(img, 255,
                                                                    cv2.ADAPTIVE_THRESH_GAUSSIAN_C,
                                                                    cv2.THRESH_BINARY,
                                                                    31, -10)
            contours, _ = cv2.findContours(copy.copy(img),
                                                                       cv.CV_RETR_LIST,
                                                                       cv.CV_CHAIN_APPROX_SIMPLE)
            for contour in contours:
                    rect = cv2.boundingRect(contour)
                    ratio = float(rect[3]) / rect[2]
                    if rect[3] * rect[2] > 800:
                            for gr in gost_ratio:
                                    if abs(ratio - gr) < min_error:
                                            cv2.rectangle(img_src,
                                                                      (rect[0], rect[1]),
                                                                      (rect[0] + rect[2], rect[1] + rect[3]),
                                                                      (255, 0, 0), 2)
                                            break
    
            edge_matrix = numpy.array([[-0.0, -1.0, 0.0, 1.0, 0.0],
                                       [-1.0, -2.0, 0.0, 2.0, 1.0],
                                       [-0.0, -1.0, 0.0, 1.0, 0.0]])
            img = cv2.filter2D(img, -1, edge_matrix)
            py = []
            for y in range(img.shape[0]):
                    py.append(rms(img[y, :]))
            pys = sma(py, 3)
            pyp = []
            for i in range(len(pys) - 1):
            	pyp.append(abs(pys[i + 1] - pys[i]))
            pyps = sma(pyp, 1)
            #print (pyps)
    
            line_index = pys.index(max(pys))        
            cv2.line(img_src, (0, line_index), (img.shape[1] - 1, line_index), (255, 0, 0))
            cv2.imshow("img", img_src)
            cv2.imshow("img2", img)
    
            gp.plot(pys)
            
    
    compute()
    
    key = 0
    while key != 27:
            key = cv2.waitKey()
    
            if key == 65363:
                    img_index += 1
                    if img_index > max_img_index:
                            img_index = 0
                    compute()
            elif key == 65361:
                    img_index -= 1
                    if img_index < 0:
                            img_index = max_img_index
                    compute()
    
    
  2. In Topic: Analyzing a polinomial equation

    Posted 11 Apr 2014

    View PostMomerath, on 11 April 2014 - 09:39 PM, said:

    So first you'd want to break it into pieces with the sign being the indicator of a piece start (there is an implied sign in front of 'ax^2'). Unfortunatly C# does not have a "split on this character but keep this character" so you'll have to develop your own splitter.

    Next you'd want to identify what part you have and assign the value of the piece to that part. This can be fairly simple (does it parse into a number, it's the 'c' part. Does it have a ^ symbol, it's the 'a' part, otherwise must be 'b').

    Solve equation.

    Ok, I'll see if i can develop a splitter by myself, I'll do some research.
  3. In Topic: Analyzing a polinomial equation

    Posted 11 Apr 2014

    View PostMomerath, on 11 April 2014 - 09:27 PM, said:

    It depends. Will the equation always be entered as "ax^2+bx+c" or can I enter "c-bx+ax^2" or any other ordering? What about just "ax^2+c"?

    My idea was for the input to be 'modular' so ax^2+bx+c or c+bx+ax^2, both would work.
  4. In Topic: Analyzing a polinomial equation

    Posted 11 Apr 2014

    View PostSkydiver, on 11 April 2014 - 12:33 AM, said:

    Do you always know that it'll be quadratic polynomial? Do you always know what the symbol for the variable will be?

    It will always be quadratic and the variable will always be 'x'. The symbol for the variable makes difference?
  5. In Topic: Making a group management program.

    Posted 6 Jan 2014

    It's working!! Can you believe this?! hahaha.
    So, its all working like a charm, and i can't say how thankful i am to you thecoat!!
    Ok, I'll run some testing now, will have a couple of friends to help me test it, and if it all goes well, soon enough i'll port it to a website model and have it up and running!
    Really dude, this would be impossible without all your help and patience, thank you very very much.

    Full Code:
    Login:
    Imports MySql.Data.MySqlClient
    Imports GroupManager.MainCoTableAdapters
    Imports System.Reflection
    Imports System.Configuration
    Public Class Login
        Friend Myconn As MySqlConnection
        Friend constr As String
        Private Sub Login_Click(sender As Object, e As EventArgs) Handles Log.Click
            Main.Close()
            Inform.Close()
            Dim db As String = "bfdepredb"
            Dim checktquery As String = "CREATE TABLE IF NOT EXISTS PunishTable (UserID  SERIAL, FirstName VARCHAR(50), LastName VARCHAR(50), Strike VARCHAR(10), Reason VARCHAR(150), Ptime DATETIME, PRIMARY KEY (UserID) )"
            Dim builder As New MySqlConnectionStringBuilder
                With builder
                    .Server = txtserver.Text
                .UserID = txtusername.Text
                .Password = txtpassword.Text
                .Database = db
            End With
            Try
                updateRecord(checktquery, builder.ConnectionString)
                SaveCon(builder.ConnectionString)
                Me.Hide()
                Main.Show()
            Catch ex As Exception
                MessageBox.Show("Alguma coisa deu errado: " & ex.Message)
            End Try
        End Sub
        Private Sub SaveCon(ByVal strcon As String)
            Try
                Dim settings = ConfigurationManager.ConnectionStrings("GroupManager.My.MySettings.bfdepredbConnectionString")
                Dim cfield As Object = GetType(ConfigurationElement).GetField("_bReadOnly", BindingFlags.Instance Or BindingFlags.NonPublic)
                cfield.SetValue(settings, False)
                settings.ConnectionString = strcon
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            End Try
        End Sub
        Private Sub Cancel_Click(sender As Object, e As EventArgs) Handles Cancel.Click
            Application.Exit()
        End Sub
        Sub updateRecord(ByVal query As String, ByVal connStr As String)
            Try
                Dim connection As New MySqlConnection(connStr)
                Dim cmd As New MySqlCommand(query, connection)
                connection.Open()
                cmd.ExecuteNonQuery()
                connection.Close()
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            End Try
        End Sub
    End Class
    

    Main:
    Imports MySql.Data.MySqlClient
    Imports System.Globalization
    Imports GroupManager.MainCoTableAdapters
    Public Class Main
        Friend cstring As String
        Friend vals(5) As String
        Dim ptadapter As New PunishTableAdapter
        Private Sub Main_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            cstring = Login.constr
            Login.Close()
            Inform.Close()
            Stkbox.Items.Add("1")
            Stkbox.Items.Add("2")
            Stkbox.Items.Add("3")
            Stkbox.Items.Add("BAN")
            LoadData()
        End Sub
        Private Sub Add_Click(sender As Object, e As EventArgs) Handles Add.Click
            ptadapter.AddUserQuery(Nbox.Text, LNBox.Text, Stkbox.SelectedText, Rbox.Text, datetomysql(DateTime.Now))
            LoadData()
        End Sub    
        Sub LoadData()
            Userview.DataSource = ptadapter.GetData
        End Sub
        Friend Function datetomysql(d As Date) As String
            Return d.ToString("yyyy-MM-dd HH:mm:ss")
        End Function
        Private Sub Userview_CellContentClick(sender As Object, e As DataGridViewCellMouseEventArgs) Handles Userview.RowHeaderMouseDoubleClick
            Dim counter As Int32 = 0
            Dim cell As DataGridViewCell
            For Each cell In Userview.SelectedCells
                vals(counter) = cell.Value.ToString
                counter += 1
            Next
            Inform.Show()
        End Sub
    End Class
    
    

    Inform:
    Imports MySql.Data.MySqlClient
    Imports GroupManager.MainCoTableAdapters
    Public Class Inform
        Dim PTI As New PunishTableAdapter
        Dim DTI As New MainCo.PunishTableDataTable
        Dim ID As Int64
        Dim justforstop As Int32
        Private Sub Inform_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            sbox.Items.Add("1")
            sbox.Items.Add("2")
            sbox.Items.Add("3")
            sbox.Items.Add("BAN")
            LID.Text = Main.vals(0)
            ID = Main.vals(0)
            Try
                rbox.Text = PTI.ScalarQueryForReason(ID)
                sbox.SelectedItem = PTI.ScalarQueryForStrike(ID)
                nbox.Text = PTI.ScalarQueryForFirstName(ID)
                lnbox.Text = PTI.ScalarQueryForLastName(ID)
            Catch ex As Exception
                MessageBox.Show("Alguma coisa deu errado: " & ex.Message)
            End Try
    
        End Sub    
        Private Sub Save_Click(sender As Object, e As EventArgs) Handles Save.Click
            Dim Tstring As String = Main.datetomysql(DateTime.Now)
            PTI.UpdateQuery(nbox.Text, lnbox.Text, sbox.SelectedItem, rbox.Text, Main.datetomysql(DateTime.Now), LID.Text)
            Main.LoadData()
            Me.Close()
        End Sub
    
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            MessageBox.Show("Você tem certeza?", "", MessageBoxButtons.YesNoCancel)
            If DialogResult.Yes Then
                PTI.DeleteQuery(ID)
                Main.LoadData()
                Me.Close()
            ElseIf DialogResult.No Then
                DialogResult = Windows.Forms.DialogResult.Cancel
            End If
        End Sub
    End Class
    

My Information

Member Title:
D.I.C Regular
Age:
Age Unknown
Birthday:
April 30
Gender:
Location:
Brasil
Interests:
Programing
Games
Shooting
Racing
Full Name:
Bernardo Meurer
Years Programming:
1
Programming Languages:
VB.NET (A little),C(A little),C#(A little)

Contact Information

E-mail:
Private
Skype:
Skype  Bernardo_Meurer_Costa
Twitter:
Bernardo_Meurer

Friends

Comments

Raminator has no profile comments yet. Why not say hello?