Friday, November 30, 2018

Ubuntu 16 OpenCV 2.4

Problems during compilation:

relocation R_X86_64_32 against `ff_a64_muxer' can not be used when making a shared object

Solution:
recompile ffmpeg-3.4.5 with(2018-11-29):
./configure --enable-nonfree --enable-pic --enable-shared

Download ffmpeg and build 3.4.5, 3.2.12 or 4.0 and try to compile opencv doesn't help, then

Final solution: disable ffmpeg
$cmake  -D WITH_CUDA=OFF -D WITH_FFMPEG=0 ..
$make

That compile opencv 2.4.x and 3.4.x



References:
[1] Error sys/videoio.h not found problem http://yutopapa.hatenadiary.com/entry/2017/06/08/173149

Tuesday, November 27, 2018

ASP.NET MVC Mono

Settings at 11/2018

.Net Framework 4.5.2 using project properties
Mysql.Data.Entity using NuGet(6.10.8)

Setup Web.config

<!--Added--> 
<configSections> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.2.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections> 
<connectionStrings> 
  <add name="ferredb" connectionString="server=127.0.0.1;Port=3306;Database=ferre;Uid=root;Pwd=Microsoft;" providerName="MySql.Data.MySqlClient"/> </connectionStrings> 
<!--Added--> 
<entityFramework> 
<providers> 
  <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.10.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
  </provider> 
</providers> 
</entityFramework> 
<!--Added--> 
<system.data> 
<DbProviderFactories> <remove invariant="MySql.Data.MySqlClient" /> <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.10.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/> 
 </DbProviderFactories> 
</system.data>

Fix version of entry System.Web.Mvc.MvcWebRazorHostFactory at views/Web.config


Classes

//Ado
using System;
using System.Data.Entity;
using MySQLEntity.Models;

namespace MySQLEntity.Entity
{

public class MyDb : DbContext
{
public MyDb() : base("ferredb")
//public MyDb() : base(nameOrConnectionString: "ferredb")
{
}
public DbSet<Usuario> Usuarios { get; set; }
}


}


//Entity
using System;
//Added
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;


namespace MySQLEntity.Models
{
        [Table("Users")]
        public class Usuario
        {
            [Key]
            public string usuario { get; set; }
            public string apenom  { get; set; }
        }

}



Controller Snippet code

public ActionResult Index()
{
  MyDb db = new MyDb();
  var Model=db.Usuarios.ToList();
  return View(Model);
}

View Snippet code


@foreach (var item in Model)
{


<div> @item.usuario @item.apenom </div>
}

Action results
Types

References:
[1] MySQL EntityFramework web.config https://iyalovoi.wordpress.com/2015/04/06/entity-framework-with-mysql-on-mac-os/
[2] Action results
https://www.c-sharpcorner.com/article/different-types-of-action-results-in-asp-net-mvc/
[3] ViewBag better than DataView http://www.tutorialsteacher.com/mvc/viewbag-in-asp.net-mvc


Monday, November 26, 2018

mySQL Develop Optimization



Select * from MOVPRO where fecmov>='2018-11-25' and tipmov='S'
EXPLAIN Select * from MOVPRO where fecmov>='2018-11-25' and tipmov='S'

CREATE INDEX MOVPRO_fecmov_tipmov_index ON MOVPRO (fecmov,tipmov)


References:
[1] faster using indexes https://blog.nodeswat.com/making-slow-queries-fast-with-composite-indexes-in-mysql-eb452a8d6e46

python3 using mysql connection



$pip3 install mysql-connector-python --user

from mysql.connector import (connection)


cnx=connection.MySQLConnection(user='user', password='*******',
             host='ip', database='db')

cnx.close()


Resources:
[1] https://dev.mysql.com/doc/connector-python/en/connector-python-installation.html

API Testing



References
[1] postman https://steelkiwi.com/blog/api-testing-useful-tools-postman-tutorial-and-hints/

Water Simulation

Compiling Sources:
[1] 2D SPH https://github.com/tizian/SPH-Water-Simulation
    $sudo apt-cache search sfml
    $sudo apt-get install libsfml-dev
    #change for's
    $make
    $./sph

[2] WebGL water simulation https://experiments.withgoogle.com/webgl-water-simulation

[3] Google webgl https://experiments.withgoogle.com/search?q=fluid
  [3.1] http://david.li/fluid/
  [3.2] http://madebyevan.com/webgl-water/
[4] 3D Simulation/Animation/Fluids and more https://www.fetchcfd.com/search-projects/type/cfd

Related:
[1] Stanford su2 https://su2code.github.io/
[2] Multiple Interacting Fluids https://www.yiningkarlli.com/projects/multifluid.html

São Carlos to Guarulhos


1) Expensive alternative

São Carlos - SP to Rodoviária Tietê, São Paulo - SP  66.53R
https://passagemcometa.com.br

São Carlos - SP to Rodoviária Tietê, São Paulo - SP  66.55R
http://www.empresacruz.com.br

São Paulo - Tietê - SP to Aeroporto de Guarulhos      37.00R
http://www.airportbusservice.com.br/

2) Cheap alternative


São Carlos - SP to Campinas - SP                               40.53R
https://passagemcometa.com.br


São Carlos - SP to Campinas - SP                               40.55R
http://www.empresacruz.com.br

Campinas-SP to Aeroporto de Guarulhos-SP             42.75R
https://www.buscaonibus.com.br

Thursday, November 08, 2018

Physics resources

Physic Courses
[1] Cursos de Graduação em Engenharia do ITA http://www.ief.ita.br/~rrpela/

Thursday, October 11, 2018

Filtering



References:
[1] http://cattedraledigitale.isti.cnr.it
      2012 Bilateral filters https://onlinelibrary.wiley.com/doi/full/10.1111/j.1467-8659.2011.02078.x

[2] http://files.is.tue.mpg.de/pgehler/assets/publications/jampani16learning/jampani16learning.pdf
[3] https://zapdf.com/fast-high-dimensional-filtering-using-clustering.html


[6] http://www.inf.ufrgs.br/~oliveira/students_dissertations/PhD/Eduardo_Gastal_PhD_Dissertation.pdf
[7] https://is.tuebingen.mpg.de/uploads_file/attachment/attachment/259/0766_cameraready.pdf
[8] http://www.scitepress.org/Papers/2016/57151/57151.pdf
[9] http://vision.ai.illinois.edu/publications/yangijcv2015.pdf
http://openaccess.thecvf.com/content_cvpr_2018/papers/Wu_Fast_End-to-End_Trainable_CVPR_2018_paper.pdf
http://perso.ensta-paristech.fr/~manzaner/Publis/icpr10.pdf
http://www.cs.cityu.edu.hk/~rynson/papers/tcsvt16a.pdf
https://arxiv.org/pdf/1505.00077.pdf
https://fukushima.web.nitech.ac.jp/paper/2016_visapp_fujita.pdf
http://www.riken.jp/brict/Yoshizawa/Papers/cgf09yby.pdf

High-dimensional integration without Markov chains, Alexander gray
https://www.cs.ubc.ca/~nando/nipsfast/slides/high.pdf

Fast edge-preserving/-aware high dimensional filters for image & video processing https://www.slideshare.net/yuhuang/fast-edge-preservingaware-high-dimensional-filters-for-image-video-processing

 

Aditional
[1] Parallel methods for Numeric Analysis http://adl.stanford.edu/cme342/Home.html
[2] Fast Multipole Methods https://www.math.uci.edu/~chenlong/MathPKU/FMMsimple.pdf

Resources
[1] ImageStack https://code.google.com/archive/p/imagestack/
                          https://github.com/abadams/imagestack
[2] RGBD Utils, use ImageStack https://github.com/s-gupta/rgbdutils

[3] Recursive bilateral filtering  https://github.com/ufoym/RecursiveBF
    ./rbf girl_out.bmp girl.bmp 0.1 0.04
    file https://media.macphun.com/img/uploads/uploads/macphun/noiseless/nl_slider_1_b.jpg
[4] Bilateral grid http://groups.csail.mit.edu/graphics/bilagrid/
[5] Bilateral upsampling http://people.csail.mit.edu/jiawen/

Python tools
[1] ndimage 3D convolution https://docs.scipy.org/doc/scipy-0.16.0/reference/ndimage.html


Monday, September 24, 2018

opengl compile error

Compiling Collisions, quadtrees, uniform grid.

https://github.com/MarcusMathiassen/P2D

$g++ Circle.cpp getTime64.cpp Process.cpp Utility.cpp Color.cpp      hwinfo.cpp Inputs.cpp Quadtree.cpp  Vec2.cpp Config.cpp main.cpp Rect.cpp FixedGrid.cpp Node.cpp Render.cpp -I ../include/  -lGL -lglut -lGLU -lGLEW -lpthread -lX11 -lglfw  -o q5


error while loading shared libraries: libGLEW.so.2.1: cannot open shared object file: No such file or directory

$sudo apt-get install libglew-dev
$locate libGLEW.so.2.1
...
/usr/lib64/libGLEW.so.2.1.0
/usr/local/lib/libGLEW.so.2.1
/usr/local/lib/libGLEW.so.2.1.0
...
...

sudo vi /etc/ld.so.conf.d/glew.conf
/usr/local/lib

$sudo ldconfig

Resources:
[1] https://sourceforge.net/projects/glew/files/glew/snapshots/

Friday, September 14, 2018

3D Models & tools


1) Open .obj 3D format

view3dscene
$sudo apt-get install view3dscene

meshlab - System for processing and editing triangular meshes
$sudo apt-get install meshlab

g3dviewer
$sudo apt-get install  g3dviewer

Other tools

  1. glc_player which is said to read-and-show '.3ds', '.obj', '.stl', '.off', '.3dxml', and Collada ('.dae') files
  2. g3dviewer which is said to read-and-show '.3ds', '.lwo', '.obj', '.dxf', '.md2', '.md3', '.wrl', '.vrml', '.dae' (COLLADA), '.ase' (ASCII Scene Exporter), '.ac' (AC3D)
  3. ivview which reads-and-shows '.iv' and VRML1 files
  4. paraview which reads-and-shows '.ply' and '.vt*' files
  5. varicad-view which reads-and-shows '.dwg' (2D), '.dxf' (2D only?), '.igs' (maybe?), '.stp' (3D) files 
  6. wings3d - Nendo-inspired 3D polygon mesh modeller (legacy)
  7. gmsh - Three-dimensional finite element mesh generator
  8. libadmesh-dev - Tool for processing triangulated solid meshes.
  9. libgmsh-dev - Three-dimensional finite element mesh generator.
  10. libmadlib-dev - mesh adaptation library
  11. libnglib-dev - Automatic 3d tetrahedral mesh generator development files
  12. libscotch-dev - programs and libraries for graph, mesh and hypergraph partitioning
  13. netgen - Automatic 3d tetrahedral mesh generator
  14. libtriangle-dev - High-quality 2-D mesh generator development files
Resources
 [1] mview http://mview.sourceforge.net/

Models
  [1] .max, .obj, blender, etc. www.turbosquid.com
  [1] http://tf3dm.com/

Thursday, September 13, 2018

Python extending functions from C/C++



References
[1] https://docs.python.org/3/library/ctypes.html

https://cython.readthedocs.io/en/latest/src/tutorial/cython_tutorial.html
https://opensourceforu.com/2010/05/extending-python-via-shared-libraries/
https://en.wikibooks.org/wiki/Python_Programming/Extending_with_C%2B%2B


Friday, September 07, 2018

Linear Regresion



[1] Regresion linear http://onlinestatbook.com/2/regression/intro.html
[2] https://towardsdatascience.com/linear-regression-with-example-8daf6205bd49


Wednesday, September 05, 2018

pip3 ImportError: cannot import name 'main'


In linux you need to change the file: /usr/bin/pip3 from:
 
from pip import main
if __name__ == '__main__':
    sys.exit(main())

to:

from pip import __main__
if __name__ == '__main__':
    sys.exit(__main__._main())
 
 

Running apps

Runtastic (I uninstalled because force to update your device - Internet connection problems) Runkeeper  (Wrong GPS tracking) Strava   (Curr...